Python if / elif / else Quiz
1. What does an if statement do?
Repeats code
Makes decisions
Defines a function
Stores data
2. Which keyword means "else if"?
else
elseif
elif
ifelse
3. What symbol must end an if condition?
;
:
.
,
4. What will this print?
x = 5
if x > 10:
print("A")
else:
print("B")
A
B
Nothing
Error
5. How many else blocks can an if statement have?
One
Two
Unlimited
None
6. Which comparison checks equality?
=
==
!=
>=
7. Which statement runs if all conditions are False?
if
elif
else
break
8. What happens if indentation is wrong?
Python ignores it
Program runs slower
Syntax error
Logic error only
9. Which logical operator means BOTH must be true?
or
and
not
==
10. What will this print?
if True:
print("Yes")
Yes
No
Nothing
Error
Submit Quiz
← Back to Lesson