StudenteCare mission is to give people the power to build educational community and bring the Educators, Students, Parents, Consultant, University, Colleges, Schools and Coachings closer together
Ncert Solution | Ncert Solution for class 11th | Ncert Solutions for class 11 Computer Science Python | NCERT COMPUTER SCIENCE PYTHON CHAPTER 10 FUNCTIONS
by   Pooja Singla
Files Overall Price:    0.00
Videos Overall Price:    0.00
Total Overall Price:    0
Sold By:    Pooja Singla


Description Above File

NCERT Solutions for Class 11 Computer Science (Python) Chapter 10 Functions

Ncert solutions for class 11 Computer Science Python Chapter 10 Functions are prepared by CBSE student eCARE expert to score good marks in class 11. Classes 11 Computer Science Python Chapter 10 Functions contain many topics which are very important to score good in class 11. There are some important topic mentioned below:

Here are simple rules to define a function in Python.

? Function blocks begin with the keyword def followed by the function name and Parentheses ()
? Any input parameters or arguments should be placed within these parentheses.
? The first statement of a function can be an optional statement – the documentation string of the function or docstaing.
? he code block within every function start with color(:) and is indented.
? The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return none.

 

? A high order function accepts one or more functions as input and returns a new function. Sometimes it is required to use function as data.
? To make high order function, one need the import functools module.
? The functools.partial() function is used often for high order function.



Description Below File

Some questions are asked by class 11 students related to Computer Science (Python)

Question 1:
What is a Python module ? What is its significance ? .
Answer:
A ‘module’ is a chunk of python code that exists in its own (.pu) file and is intended to be used by python code outside iteself. Modules allow one to fundle together code in a form in which it can easily be used later.
The modules can be ‘imported’ in other programs so the function and other definitions in imported modules becomes availabe to code that imports them.

Question 2:
“Python has certain functions that you can readily use without having to write any special code.” What type of functions are these ?
Answer:
The pre-defined functions that are always available for use are known as python’s built-in functions. For example :
len (), type (), int (), raw-input () etc.

Question 3:
What is the utility of built-in function help () ?
Answer:
Python’s built in function help ( ) is very useful. When it is provided with a program-name or a module-name or a function-name as an argument, it displays the documentation of the argument as help. It also displays the docstrings within its passed-argument’s definition. For example :
help (math)
will display the documentation related to module math.

Question 4:
What is the utility of Python standard library’s math module and random module ?
Answer:
Math module is used for math related functions that work with all number types except for complex numbers, radom module is used for different random number generator functions.

Question 5:
What is raw_input?
Answer:
It is a function which takes a string (e.g., a question) as argument, writes the string to the terminal window, halts the program and lets the user write in text on the keyboard, and then the text is returned to the calling code as a string object.

Question 6:
What value will be return by log(x[, base])?
Answer:
With one argument, return the natural logarithm of x (to base e).
With two arguments, return the logarithm of x to the given base, calculated as log(x) log(base)

Question 7:
Define pow(x, y) function in Python ?
Answer:
Return x raised to the power y.. In particular, pow(1.0, x) and pow(x, 0.0) always return 1.0, even when x is a zero or a NaN. If both x and y are finite, x is negative, and y is not an integer then pow(x, y) is undefined, and raises ValueError.

Question 8:
Determine what is printed by the following program listinput.py,
list1 = eval(raw_input(‘Give a list:’))
list2 = eval(raw_input(‘Give another list:’))
print list1 + list2
When the program is running as follows:
Unix/DOS > python listinput.py
Give a list: ‘[1,2]’
Give another list: “[3,4]”
Answer:
[1,2] [3,4]

Question 9:
What will be the output of this program?
a = 20.3
b = ‘Python’
c = ‘”Python”‘
d = 21
print isinstance(a, float),
print isinstance(b, (str, int)),
print isinstance(c, (str, str)),
print isinstance(d, (float, str))
Answer:
True, True, True, False.

Question 10:
Write any Python expression which is a valid input argument to the following program?
input = eval(raw_input(‘Value:’))
print ‘You typed’, value
Answer:
‘one’

Question 11:
Given the program
from scitools.StringFunction import
StringFunction
import sys
formula = sys.argv[1]
f = StringFunction(formula)
print f(2)
Will this input work?
Unix/DOS > python function.py ‘t**2’
Answer:
No, This input will not work