PRACTICE • LEARN • GROW
Module 4: Control Flow - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 4: Control Flow - Final Quiz Progress
0 of 13 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
What is the keyword used in Python for chained conditional branching (equivalent to 'else if' in C/Java)?
A.
elseif
B.
else if
C.
elif
D.
case
Explanation & Key
Correct Answer:
2
What will be the output of the following boolean short-circuit expression?
print(0 or 5 and 10)
A.
True
B.
5
C.
10
D.
0
Explanation & Key
Correct Answer:
3
What will be printed by the following range step loop?
for i in range(5, 0, -2):
print(i, end=" ")
A.
5 4 3 2 1
B.
5 3 1
C.
5 3 1 0
D.
5 3
Explanation & Key
Correct Answer:
4
What will be the output of the following while loop?
x = 1
while x < 5:
x *= 2
print(x)
A.
4
B.
8
C.
5
D.
2
Explanation & Key
Correct Answer:
5
What will be printed by the following loop containing an else block?
for i in range(3):
if i == 5:
break
else:
print("Completed")
A.
Completed
B.
Nothing
C.
SyntaxError
D.
5
Explanation & Key
Correct Answer:
6
What will be printed by this loop where break IS triggered?
for i in range(3):
if i == 1:
break
else:
print("Completed")
print("Done")
A.
Completed Done
B.
Done
C.
Completed
D.
1 Done
Explanation & Key
Correct Answer:
7
What is the purpose of the
pass statement in Python?
A.
It skips the rest of the current loop iteration
B.
It is a null statement (no-op) that does nothing, used as a placeholder where syntax requires a statement
C.
It passes arguments to another function
D.
It exits the program cleanly
Explanation & Key
Correct Answer:
8
What feature was introduced in Python 3.10 to provide multi-way branching and object destructuring similar to switch/case?
A.
switch-case expressions
B.
Structural Pattern Matching (match-case)
C.
select-case statements
D.
branch-case blocks
Explanation & Key
Correct Answer:
9
What is the output of Python's ternary conditional expression?
status = 200
msg = "Success" if status == 200 else "Error"
print(msg)
A.
Success
B.
Error
C.
True
D.
SyntaxError
Explanation & Key
Correct Answer:
10
What is the output of the following Walrus operator (:=) expression introduced in Python 3.8?
if (n := len([10, 20, 30])) > 2:
print(n * 2)
A.
6
B.
3
C.
TypeError
D.
True
Explanation & Key
Correct Answer:
11
What will happen when attempting to remove elements from a list while iterating over it directly?
nums = [1, 2, 3, 4]
for n in nums:
if n % 2 == 0:
nums.remove(n)
print(nums)
A.
[1, 3]
B.
[1, 3, 4]
C.
[1, 2, 3, 4]
D.
RuntimeError
Explanation & Key
Correct Answer:
12
What is printed by the continue statement in this loop?
total = 0
for i in range(1, 6):
if i % 2 == 0:
continue
total += i
print(total)
A.
15
B.
9
C.
6
D.
0
Explanation & Key
Correct Answer:
13
Which statement about Python's
for loop is accurate?
A.
It can only iterate over sequences of numbers
B.
It iterates directly over any object implementing the iterator protocol
C.
It requires an index variable like i to be declared in advance
D.
It cannot be nested inside another loop
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong