← All Python MCQ topics and your readiness dashboard
Test your Python Basics, Variables and Operators 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 variables and dynamic typing, numbers, integer and float division, rounding and floating-point traps, type casting, truthiness, comparison chaining, logical operators and short-circuiting, identity versus equality, mutability, unpacking and the walrus operator. 21 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 Basics & Operators questions with answers
- Q. A test compares two floats. What does this code print?
import math
print(math.isclose(0.1 + 0.2, 0.3))
Answer:True
math.isclose() compares with a relative tolerance, the right way to assert on floats in tests. - Q. An environment variable is read as a string. What does this code print?
retries = "3"
print(retries * 2)
Answer:33
Environment variables are always strings; "3" * 2 repeats it. Convert with int() first. - Q. What does this code print?
flag = "False"
print(bool(flag))
Answer:True
Any non-empty string is truthy, even "False". Parse such flags explicitly, e.g. flag.lower() == "true". - Q. What does this code print?
print(7 // 2, 7 % 2)
Answer:3 1
// is floor division and % is the remainder, so 7 // 2 is 3 and 7 % 2 is 1. - Q. What does this code print?
print(-7 // 2)
Answer:-4
Floor division rounds towards negative infinity, so -3.5 becomes -4, not -3. - Q. What does this code print?
print(-7 % 3)
Answer:2
In Python the result of % takes the sign of the divisor: -7 = 3 * (-3) + 2.
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 Basics & Operators 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. 21 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.