Adaptive Practice
Flow of Control in Python
10 questions • Earn up to 110 XP • First attempt — go for 100%!
0
XP
0
Correct
x1
Combo
Question 1 of 10
⏱ 0:30
Easy
Which of the following is the correct syntax for an if statement in Python?
Easy
What will be the output of the following code?
x = 10
if x > 5:
print("Greater")
else:
print("Smaller")
Easy
Which keyword is used to handle multiple conditions in Python?
Medium
What will be the output of this code snippet?
x = 15
if x > 10:
print("A")
elif x > 5:
print("B")
else:
print("C")
Medium
Which of the following loops is guaranteed to execute at least once in Python?
Medium
What is the output of the following code?
count = 0
while count < 3:
print(count)
count += 1
else:
print("Done")
Medium
In Python, what will the following code print?
for i in range(5):
if i == 3:
break
print(i)
Hard
What is the output of this code?
for i in range(1, 5):
if i % 2 == 0:
continue
print(i)
Hard
Which of the following statements about Python's pass statement is true?
Hard
Consider the code:
x = 5
if x > 0:
if x < 10:
print("A")
else:
print("B")
else:
print("C")
What will be the output?