#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · INSTANT FEEDBACK

Python MCQ Quiz: Check Your Python Basics with Real Output Questions

Answer 21 Python questions and learn the reason behind each answer.

  • 🐍 21 questions
  • ✅ Answers tested in Python
  • 🔀 Shuffled every time

How to use the Python MCQ Quiz

  1. 1. Pick the lengthChoose 10 Python questions or all 21, with shuffle on or off.
  2. 2. Answer each questionTap an option to see at once if it is right, plus a short Python explanation.
  3. 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.

More free tools

See all free tools