WorksheetsModule 1-Flow Control_5th_Semseter
Total questions: 10
Worksheet time: 5mins
Name
Class
Date
1.
1.Which of the following is a valid boolean value in Python?
a)
"True"
b)
False
2.
2. What will not True evaluate to?
a)
False
b)
True
3.
3.What will be the result of the expression 3 < 5 or 7 < 4?
a)
True
b)
False
4.
4.Which keyword is used to define a function in Python?
a)
Define
b)
def
c)
func
5.
5.Which of the following is used to handle exceptions in Python?
a)
try-except
b)
if-else
6.
6. What is the role of the break statement in Python?
a)
To continue to the next iteration of a loop
b)
To exit the program
7.
7. What is the purpose of the randint(a, b) function in the random module?
a)
Generates a random integer in the range [a, b)
b)
Generates a random integer in the range (a, b]
c)
Generates a random integer in the range [a, b]
8.
8. What is the purpose of the randrange(start, stop, step) function in the random module?
a)
Generates a random number between start and stop
b)
Generates a random number between start and stop with a specified step
c)
Generates a random integer between start and stop with a specified step
d)
9.
9.Which function is used to find the length of a range object?
a)
count()
b)
len()
c)
length()
10.
10. In the expression range(1, 6, 2), what does the 2 represent?
a)
Starting value
b)
Ending value
c)
Step size
100 %
