Page 256 - Computer Science Class 11 Without Functions
P. 256
9. Which of the following function header is correctly defined?
a. def test(a=10, b=20, c):
b. def test(a=10, b, c=30):
c. def test(a, b=20):
d. def test(a=30, b, c):
10. Which of the following statements is not true with respect to functions in Python?
a. By default, the arguments in a function call are specified in the same sequence as in the formal parameter list.
b. Python allows us to specify the input arguments to a function in an arbitrary order by explicitly associating the names
of the formal parameters with their values
c. When a user specifies the values of the default parameters, the default values are ignored.
d. The values assigned to the formal parameters during the function call, are called the default values of the
parameters.
B. State whether the following statements are True or False:
1. A Python module is a file comprising Python code. __________
2. IMPORT keyword is used to import a specific function in to a Python program. __________
3. pow() is defined in math module. __________
4. All default parameters (if any) should precede the non-default parameters. __________
5. A function can be passed as an argument to another function. __________
C. Fill in the blanks.
1. Once a module is imported, we can use all the functions defined in the module by preceding the function name by the
name of the module and a __________ operator.
2. __________ module provides several functions for random number generation.
3. The function, floor() of math module takes an integer or floating-point number as the input and returns the __________
integer greater than or equal to the argument.
4. The random() function of the random module enables us to generate a random number between __________ and
__________.
5. During function definition, if a parameter takes a default value, then all the other parameters to its __________ must also
take default values.
D. Answer the following questions.
1. What will be the output produced on the execution of the following code?
import math
number = 57
while number >= 10:
localNumber = number // 10
if localNumber % 2 == 0:
break
else:
print(math.factorial(localNumber))
number = number - 5
2. What will be the output produced on the execution of the following code?
import math
x = divmod(42, 4)
y = int(math.fmod(10, 3))
z = x + (y,)
print(z)
254 Touchpad Computer Science-XI

