Page 255 - Computer Science Class 11 Without Functions
P. 255
2. Consider the program given below:
import random
values = [10, 30, 50, 70, 90, 110, 130]
fromVal = random.randint(1, 3)
to = random.randint(2, 4)
for i in range(fromVal, to + 1):
print(values[i], end = '*')
Which of the following lines of output will never be produced on execution of the above code?
a. 50*70* b. 0*50*70* c. 30*50*70*90* d. 50*70*90*110*
3. Consider the following statements and select the output that will be produced on the execution of the following code:
>>> dict1 = {1:'one', 2:'two', 3:'three', 4:'four'}
>>> len(dict1.keys())
a. 8 b. 15 c. 4 d. 19
4. Consider the program given below:
import random
picker = random.randint(0, 3)
color = ['BLUE', 'PINK', 'GREEN', 'RED']
for i in color:
for j in range(1, picker):
print(i, end='')
print()
Which of the following lines of output will be produced on execution of the above code?
a. BLUE b. BLUE
GREEN BLUEPINK
PINK BLUEPINKGREEN
RED BLUEPINKGREENRED
c. PINK d. BLUEBLUE
PINKGREEN PINKPINK
GREENRED GREENGREEN
REDRED
5. Which of the following is NOT a function of statistics module?
a. mean() b. median() c. floor() d. mode()
6. Which of the following is True about trigonometric functions in Python?
a. They are defined in trigonometry module
b. cos() takes a positive integer or floating point number in radians as an input
c. sin() takes a positive integer or floating point number in degrees as an input
d. tan() returns the arc tan value in degrees.
7. Which of the following is false about functions defined in random module?
a. random() enables us to generate a random number between 0 and 1.
b. randint(p, q) generates random numbers between p and q, both inclusive.
c. randrange(p, q) generates random numbers between p and q, both exclusive.
d. randrange(p, q) generates random numbers between p and q, only q exclusive.
8. Which of the following functions from statistics module will return the most frequently occurring value in a list?
a. mean() b. mode() c. median() d. frequent()
Modules 253

