Page 252 - Computer Science Class 11 Without Functions
P. 252
9. What is the purpose of the sys.path.append() method in importing a custom module?
a. It appends the module's code to the Python script.
b. It specifies the module's file path.
c. It imports all functions from the module.
d. It sets the module as the main script.
10. What value does statistics.median([2, 4, 6, 8]) return?
a. 2 b. 4 c. 5 d. 6
11. When using the random module, what function call would generate a random value of either 0 or 1?
a. random.randint(0, 1)
b. random.random()
c. random.randrange(0, 1)
d. random.choice([0, 1])
B. State whether the following statements are True or False.
1. The randrange(start, stop=None, step=1) function of the random module enables us to
generate a random number between start and stop, not including stop. __________
2. Python module math enables us to compute statistical quantities like mean, median, and mode. __________
C. Fill in the blanks.
1. Python module ____________ is a useful module that enables us to generate random numbers.
2. Functions ceil and floor are available in ____________ module of Python.
3. Python module ____________ enables us to compute statistical quantities like mean, median, and mode.
D. Answer the following questions
1. Identify the function call for determining the following:
a. An odd random integer from the first 100 natural numbers.
b. Value of pi upto 2 decimal places.
c. Log value of 100 to the base 2.
d. Log value of 100 to the base 10.
e. Log value of 100 to the base e.
f. Sine value of angle having degree 45.
g. Tangent value of angle having degree 360.
h. Greatest common divisors of 18 and 34.
i. Mean height of five boys given 150,154, 160, 161, and 165 cm as their heights respectively.
j. Factorial of the number 10.
Ans: a. random.randrange(1,101,2)
b. round(math.pi,2)
c. math.log(100,2)
d. math.log(100,10)
e. math.log(100,math.e)
f. math.sin( math.pi/4 )
g. math.tan( 2*math.pi )
h. math.gcd(18, 34)
i. statistics.mean( [150, 154, 160, 161, 165] )
j. math.factorial(10)
250 Touchpad Computer Science-XI

