MCQs
MCQs
129
D) repeating the loop indefinitely
Answer: B) premature exit from the loop
A) 7
B) 2.5
C) 2
D) error
Answer: B) 2.5
10. What is the purpose of the range() function in the for loop in Python?
A) Generating a sequence of numbers
B) performing mathematical operations
C) Checking membership in a list
D) Calculating the factorial of a number
Answer: A) Generating a sequence of numbers
130
Answer: B) 123_variable
12. Which operator is used to check whether two values are equal in Python?
A) ==
B) !=
C) <=
D) >
Answer: A) ==
131
D) All of the above
Answer: D) All of the above
132
C) [5, 4, 8, 3, 2]
D) [4, 8, 3, 2]
Answer: B) [2, 3, 8, 4]
28. Which method deletes the last inserted (key, value) pair from the dictionary?
A) pop()
B) popitem()
133
C) del()
D) del
Answer: B) popitem()
31. To include the use of functions which are present in the random library, we must use the
option:
A) import random
B) random.h
C) import.random
D) random.random
Answer: A) import random
134