← All Python MCQ topics and your readiness dashboard
Test your Conditions, match and Control Flow knowledge with a timed Python MCQ mock test for interviews. Each attempt gives you 20 random questions in 20 minutes from a 200-question bank covering if, elif and else, conditional expressions, truthiness, guard clauses, all() and any(), structural pattern matching with match/case (literal, OR, sequence, mapping and class patterns, guards and capture pitfalls), loop else, break and continue, and branch coverage and boundary values for testers. 34 questions are written from a QA and test-automation angle and the rest from a developer angle; your result shows both scores.
What this Python MCQ test covers
Revise these lessons from the free Python tutorial before or after your test:
Sample Python Conditions & match questions with answers
- Q. Classifying an HTTP status in a test helper. What does this code print?
code = 302
if 200 <= code < 300:
kind = "success"
elif 300 <= code < 400:
kind = "redirect"
else:
kind = "error"
print(kind)
Answer:redirect
Range checks with chained comparisons read like the specification. - Q. Checking that every test passed. What does this code print?
results = {"login": "pass", "cart": "fail", "search": "pass"}
print(all(v == "pass" for v in results.values()))
Answer:False
all() with a generator checks every result; one failure makes it False. - Q. What does this code print?
results = {"login": "pass", "cart": "fail"}
failed = [k for k, v in results.items() if v != "pass"]
print(failed or "all green")
Answer:['cart']
An empty failure list would be falsy and print "all green"; here one test failed. - Q. What does this code print?
x = 15
if x > 10:
print("big")
elif x > 5:
print("medium")
else:
print("small")
Answer:big
Only the first true branch runs; elif is not checked once if matched. - Q. What does this code print?
x = 15
if x > 10:
print("a")
if x > 5:
print("b")
Answer:a b
Two separate if statements are both checked, so both lines print. - Q. What does this code print?
x = 0
if x:
print("truthy")
else:
print("falsy")
Answer:falsy
An if tests truthiness; 0 is falsy.
Every predict-the-output question in this bank was run on Python 3, so the answer is the real output. Go back to the Python MCQ dashboard to see your overall Python learning progress and interview readiness.
Frequently asked questions
How many questions does the Python Conditions & match MCQ test have?
The bank has 200 questions. Each test picks 20 at random, favouring questions you have not seen yet, so about 10 attempts cover the whole bank.
How long is each test and what is the pass mark?
Each test has a 20-minute timer and submits itself when time runs out. You pass with 70%, which is 14 of 20 correct.
Is this test useful for QA and automation engineer interviews?
Yes. 34 of the questions use test-automation scenarios such as parsing UI text, test data and assertions, and your result shows your QA score separately.
Can I retake the test?
Yes, as often as you like. Every retake draws a fresh set of 20 questions and counts toward your 20-test readiness target.