How to use the Python MCQ Quiz
- 1. Pick the lengthChoose 10 Python questions or all 21, with shuffle on or off.
- 2. Answer each questionTap an option to see at once if it is right, plus a short Python explanation.
- 3. See your scoreFinish to get your Python score and a review of all your answers.
What this quiz covers
The questions cover what Python tests and interviews ask about most:
- Numbers and operators: / vs //, floor division with negatives, ** and its right-to-left order, and floating-point surprises.
- Strings and slicing: indexing and reversing with [::-1].
- Collections: which types are mutable, sets removing duplicates, dict.get, list methods such as pop.
- Comprehensions and generators, and what range really produces.
- Functions: *args, and the mutable default argument trap.
- Good practice: is vs ==, with open, exceptions and indentation.
Worked example and how to use it
Example: What is -7 // 2? Many people answer -3, but the answer is -4. Floor division always rounds down, towards minus infinity, and -3.5 rounded down is -4. In contrast, int(-3.5) cuts towards zero and gives -3.
Another favourite is the mutable default argument. With def f(x, l=[]), calling f(1) and then f(2) returns [1, 2], because the default list is created once and reused. The fix is l=None and creating the list inside the function.
All code-output answers were run in Python 3 to make sure they are right. Test any question yourself in the Python online compiler, or watch it step by step in the Python code visualizer. Seeing the code run line by line is the fastest way to fix a wrong guess.
Frequently asked questions
Which Python version does it follow?
Python 3. All answers were checked in Python 3.
Is it good for placement tests?
Yes. Output-based questions like these are common in coding rounds and technical MCQ sections.
Can I take it more than once?
Yes, as often as you like. Questions and options are shuffled each time.
Is the quiz free?
Yes, it is free. Answering questions needs no sign-up. Your final score asks for your name and WhatsApp number once, then every Uncodemy tool works without it.