Quizzes

Python Conditional Statements Quiz


Welcome to the Python Control Flow (Conditional Statements) Quiz!

In Python, control flow (conditional statements) provides logical structure of decision making. The quiz will test your understanding of if, elif, else, and other control flow concepts in Python.
Each question is designed to strengthen your problem-solving skills. Let’s see how well you know Python’s decision-making structures!

Table of Contents:


Conditional Statements Quiz


Quiz Questions:

1. What will be the output of the following code?

if x > 5:
print("Greater")
else
print("Smaller")

2. What keyword is used for a conditional statement in Python?


3. What will be printed?

num = 7
if num % 2 == 0:
print("Even")
else:
print("Odd")

4. What does elif stand for?


5. What will be the output?

x = 20
if x < 10:
print("Low")
elif x < 30:
print("Medium")
else:
print("High")

6. Can you use multiple elif statements in an if-elif-else structure?


7. What will be printed?

x = 15
if x > 10:
if x < 20:
print("Between 10 and 20")

8. What happens if no condition in an if-elif-else chain is true?


9. What will be the output?

x = 5
y = 10
if x > y:
print("X is greater")
elif x < y:
print("Y is greater")
else:
print("Equal")

10. What type of values do conditional expressions evaluate to?


11. What will be printed?

x = 3
if x:
print("True")
else:
print("False")

12. What is the correct syntax for an if statement?


13. What will be printed?

a = 0
if not a:
print("Zero")

14. What will be the output?

x = 100
if x > 50 and x < 200:
print("Valid")

15. What is the result of this expression?

if 0:
print("Yes")
else:
print("No")

16. What happens if we write an if condition without indentation?


17. What will be printed?

x = 20
if x == 10 or x == 20:
print("Match")

18. How do you check if a number is negative?


19. What will be printed?

x = 5
y = 10
if x and y:
print("Both True")

20. What will be the output?

x = None
if x:
print("Value exists")
else:
print("No value")

How did you do? 🎯

  • 18-20 correct → 🏆 Excellent! You’re a Python functions pro!
  • 14-17 correct → 👍 Great job! Keep practicing.
  • 10-13 correct → 🙂 Good, but there’s room for improvement.
  • Below 10 → 🤔 No worries! Review the concepts and try again.

by AICorr Team

We are proud to offer our extensive knowledge to you, for free. The AICorr Team puts a lot of effort in researching, testing, and writing the content within the platform (aicorr.com). We hope that you learn and progress forward.