MCQ Quiz All Levels

Python MCQ — Basics to Advanced

30 multiple-choice questions covering Python syntax, data structures, OOP, decorators, generators, exceptions, and the standard library.

30 Questions
All Levels Level
100% Free
January 20, 2025 DB 30 questions
What is the output of `print(type([]))` in Python?
Which of the following is an immutable data type in Python?
What does `len({'a': 1, 'b': 2, 'c': 3})` return?
What is the output of `[1, 2, 3][1:2]`?
Which keyword is used to define a generator function in Python?
What will `bool([])` evaluate to?
What does `*args` in a function definition collect?
What is the result of `10 // 3` in Python?
Which of these creates a shallow copy of a list `lst`?
What is the output of `print('abc'[-1])`?
Which decorator is used to define a class method that receives the class as the first argument?
What does the `__init__` method do in a Python class?
What is the GIL in Python?
Which module provides the `deepcopy` function?
What is the output of `list(range(0, 10, 3))`?
What will `{1, 2, 3} & {2, 3, 4}` return?
What does `functools.wraps` do when writing a decorator?
Which of these is the correct way to open a file safely in Python?
What is the output of `print(2 ** 3 ** 2)`?
What does `enumerate(['a', 'b', 'c'])` return?
What is the difference between `is` and `==` in Python?
What happens when you call `next()` on an exhausted generator?
Which built-in function converts a string to an integer?
What does the `@property` decorator do?
What is the purpose of `__slots__` in a Python class?
Which module would you use for asynchronous HTTP requests in Python?
What does `dict.get('key', 'default')` do when the key doesn't exist?
What is a `lambda` function in Python?
What does `Counter('aabbbcc').most_common(2)` return?
Which of the following correctly uses `asyncio.gather()`?

Suggest More MCQ Questions

Know a question that should be in this quiz? Submit it and help the community!

Open Google Form