Page 300 - Computer Science Class 11 With Functions
P. 300
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. Differentiate between the default arguments and keyword arguments.
2. Consider the following function header of the function responsible for multiplying three numbers:
def multiply(num1, num2 = 5, num3 = 6):
Give suitable function calls to specify the below-mentioned arguments while other arguments take default values:
a. num1 = 6, num3 = 7
b. num1 = 4
3. Consider the following function header:
def testCall(num1, num2 = 10, num3 = 100):
Which of the following function call statements will be executed correctly? Justify your answer.
(a) testCall(20)
(b) testCall(num2 = 20)
(c) testCall(num2 = 20,num1 = 30)
(d) testCall(50,500,5000)
(e) testCall()
(f) testCall(val,num3 = 50) ( Assume val=500)
(g) testCall(num3 = 50,num1 = 500)
4. Predict the output of the codes given below:
(i) def myfunc(arg1 = 2, arg2 = 3):
arg1 = arg1 + arg2
arg2 = arg1 - arg2
print(arg1, "###",arg2)
return arg1
P = 10
Q = 20
P = myfunc(Q)
print(P, "###", Q)
Q = myfunc()
print(P, "###", Q)
5. 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
298 Touchpad Computer Science-XI

