Python - MCQ
Multiple Choice Questions
Python - Multiple Choice Questions (MCQ) - Basics of Python - Set 7
31. Which operator has higher precedence in the following list
A). % Modulus
B). & BitWise AND
C). **, Exponent
D). > Comparison
View Answer
Correct: C
32. What is the output of the following code?
sampleList = ["Jon", "Kelly", "Jessa"]
sampleList.append(2, "Scott")
print(sampleList)
A). The program executed with errors
B). [‘Jon’, ‘Kelly’, ‘Scott’, ‘Jessa’]
C). [‘Jon’, ‘Kelly’, ‘Jessa’, ‘Scott’]
D). [‘Jon’, ‘Scott’, ‘Kelly’, ‘Jessa’]
View Answer
Correct: A
33. Can we use the “else” clause for loops?
for example:
for i in range(1, 5):
print(i)
else:
print("this is else block statement" )
A). No
B). Yes
View Answer
Correct: B
34. What is the output of the following
x = 36 / 4 * (3 + 2) * 4 + 2
print(x)
A). 182
B). 37
C). 117
D). The Program executed with errors
View Answer
Correct: A
35. What is the output of the following code?
p, q, r = 10, 20 ,30
print(p, q, r)
A). 10 20
B). 10 20 30
C). Error: invalid syntax
View Answer
Correct: B
36. What is the output of the following code?
str = "ITDEVELOPER"
print (str[1:3])
A). IT
B). TD
C). ITD
D). TDE
View Answer
Correct: B