Test your Python interview readiness with MCQs covering the complete range of Python topics that appear in technical screenings for backend, data engineering, and full-stack roles. Topics include Python fundamentals, data types, mutability, list and dict comprehensions, generators and iterators, decorators, context managers, and lambda functions, as well as object-oriented programming (inheritance, multiple inheritance and MRO, dunder methods, abstract classes, dataclasses), concurrency (threading vs multiprocessing vs asyncio and the GIL), the Python data model, common standard library modules (collections, itertools, functools), and memory management. Python is the most commonly used language in data engineering, backend development, automation, and machine learning roles, and interviews across all these domains expect strong Python fluency. Difficulty levels span Trainee (syntax, built-in types, basic OOP), Junior Dev (comprehensions, common stdlib, function patterns), Mid Level (decorators, generators, concurrency basics), and Senior Dev (CPython internals, metaclasses, performance optimization). Build genuine Python fluency with timed questions and immediate explanations.
What this Python quiz covers
Trainee
- Mutable vs immutable types
- pip, int() and built-ins like abs, max, sorted
- Docstrings and booleans
- for loops and iterables
Junior Developer
- List comprehensions and filter()
- Classes: self, super() and @property
- == vs is
- global and nonlocal
Mid-Level
- The GIL in CPython
- Duck typing and monkey patching
- Shallow vs deep copy
- __slots__, namedtuple and defaultdict
Senior
- Descriptors and the MRO
- asyncio.gather
- __init_subclass__ and __call__
- Profiling with profile, cProfile and sys.settrace
Sample Python Interview Questions
Ten representative questions from our full bank of Python MCQs across all difficulty levels. Each one shows the correct answer and a short explanation. The interactive quiz above shuffles options and tracks your time per question.
- TraineeQ1
Which type is immutable?
- list
- dict
- tuple Correct
- set
Why: Tuples cannot be changed after creation. - TraineeQ2
What does len([1, 2, 3]) return?
- 2
- 3 Correct
- 4
- Error
Why: len returns the number of items in a collection. - TraineeQ3
Which keyword defines a function?
- func
- def Correct
- function
- lambda
Why: Python uses def to define named functions. - TraineeQ4
What does pip install do?
- Installs packages Correct
- Runs tests
- Formats code
- Creates classes
Why: pip installs Python packages from indexes or local paths. - Junior DevQ5
What does a list comprehension create?
- A list built from an expression applied to an iterable Correct
- A class definition
- A package file
- A background thread
Why: List comprehensions concisely build lists from iterables. - Junior DevQ6
What is *args?
- Extra positional arguments collected as a tuple Correct
- Extra keyword arguments as a dict
- A function decorator
- A package import alias
Why: *args collects additional positional arguments into a tuple. - Junior DevQ7
What is **kwargs?
- Extra keyword arguments collected as a dict Correct
- Only numeric parameters
- A positional tuple
- An import mode flag
Why: **kwargs collects additional named arguments into a dictionary. - Mid LevelQ8
What is the GIL in CPython?
- A lock allowing only one thread to execute Python bytecode at a time Correct
- A global package manager lock
- A unit test runner
- A type annotation checker
Why: The Global Interpreter Lock limits CPU-bound parallelism in CPython threads. - Mid LevelQ9
What does yield create?
- A generator function that pauses and resumes execution Correct
- A regular class method
- A dictionary entry
- A package distribution artifact
Why: yield turns a function into a generator that produces values lazily. - Senior DevQ10
When are descriptors invoked?
- During attribute access through __get__, __set__, or __delete__ Correct
- Only on module import
- Only inside loops
- Only for list items
Why: Descriptors customize attribute lookup and assignment on class instances.
This is a static preview of 10 questions. Take the full interactive Python quiz with timed rounds, all 25 questions per level, and instant score tracking.
Frequently Asked Questions: Python Interviews
Common questions developers ask when preparing for Python technical interviews.
What Python topics are most commonly tested in technical interviews?
Interviewers test Python fundamentals (data types, mutability, list vs tuple vs set vs dict), list/dict comprehensions, generators and iterators, decorators, and OOP concepts (inheritance, dunder methods, class vs static methods). For data roles, pandas, NumPy, and algorithmic efficiency with Python data structures are also tested. The GIL and concurrency (threading vs multiprocessing vs asyncio) come up in senior backend and systems roles.
What is a decorator in Python and when would you use one?
A decorator is a function that takes another function as an argument, wraps it with additional behavior, and returns the modified function. They are used for cross-cutting concerns like logging, authentication, timing, caching (functools.lru_cache is a built-in decorator), and input validation, without modifying the original function's body. Python's @syntax is syntactic sugar for passing the function to the decorator at definition time.
What is the difference between a list and a generator in Python?
A list stores all its elements in memory at once. A generator produces elements lazily, one at a time on demand using yield, consuming far less memory. Generators are ideal for processing large datasets, infinite sequences, or pipelines where you do not need all values simultaneously. You create a generator with a function using yield, or with a generator expression (parentheses instead of square brackets).
What is the GIL in Python and how does it affect concurrency?
The Global Interpreter Lock (GIL) is a mutex in CPython that allows only one thread to execute Python bytecode at a time, even on multi-core hardware. This means Python threads cannot achieve true parallelism for CPU-bound tasks, use multiprocessing instead, which spawns separate processes each with their own interpreter. For I/O-bound tasks (network requests, file reads), threading and asyncio remain effective because the GIL is released during I/O waits.
How is Python used in backend development versus data science interviews?
Backend Python interviews focus on frameworks (Django, FastAPI, Flask), OOP patterns, async programming with asyncio, REST API design, database integration, and testing. Data science and ML interviews focus on pandas, NumPy, Scikit-learn, SQL via Python, algorithm implementation, statistical thinking, and sometimes PyTorch or TensorFlow. Both tracks test Python fluency, but the applied context and depth of framework knowledge differ significantly.