Python’s decision-making statements such as if, elif, and else are essential for controlling the flow of programs. This quiz will help beginners and intermediate learners practice conditional logic and branching in Python with real-world syntax.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which keyword is used to begin a decision-making block in Python?
Correct
Incorrect
Question 2 of 15
2. Question
What is the output of this code?
x = 5 if x > 2: print(“High”)
Correct
Incorrect
Question 3 of 15
3. Question
What is the correct way to write an if-else block in Python?
Correct
Incorrect
Question 4 of 15
4. Question
Which of these is used for multiple conditional checks in Python?
Correct
Incorrect
Question 5 of 15
5. Question
What is the output of the following?
a = 10 if a < 5: print(“Small”) elif a < 15: print(“Medium”) else: print(“Large”)
Correct
Incorrect
Question 6 of 15
6. Question
Which statement executes when all if and elif conditions fail?
Correct
Incorrect
Question 7 of 15
7. Question
What is the output of if True:?
Correct
Incorrect
Question 8 of 15
8. Question
Which of the following will raise an indentation error?
Correct
Incorrect
Question 9 of 15
9. Question
Can we nest if statements in Python?
Correct
Incorrect
Question 10 of 15
10. Question
What is the output of this nested condition?
x = 8 if x > 5: if x < 10: print(“Valid”)
Correct
Incorrect
Question 11 of 15
11. Question
Which operator is used to check multiple conditions in one if statement?
Correct
Incorrect
Question 12 of 15
12. Question
What will this code print?
x = 10 if x != 10: print(“Wrong”) else: print(“Correct”)
Correct
Incorrect
Question 13 of 15
13. Question
Which of these will execute the else block?
Correct
Incorrect
Question 14 of 15
14. Question
Which condition will not trigger the if block?
if condition: print(“Run”)
Correct
Incorrect
Question 15 of 15
15. Question
What is the purpose of decision-making in Python?
Correct
Incorrect
Summary
This quiz covered all essential aspects of Python’s decision-making using if, elif, and else statements. These control structures are the backbone of logic flow in Python programs and are critical for writing dynamic, real-world applications.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.