Python Interview Questions for Freshers
Python interviews for freshers rarely test syntax trivia — they test whether you understand what's actually happening under the simple syntax: mutability, how arguments are passed, and a few Python-specific concepts like decorators and the GIL that don't exist in languages like Java or C++. Get comfortable explaining these in plain English, not just using them correctly in code.
Fundamentals Interviewers Actually Test
Mutable vs. immutable types
Lists, dictionaries, and sets are mutable — you can change them in place. Tuples, strings, and integers are immutable — any "change" actually creates a new object. This matters in practice: mutable default arguments (def f(x=[]):) are a classic Python gotcha, because that empty list is created once and shared across every call that doesn't pass its own.
List vs. tuple vs. set vs. dict
List: ordered, mutable, allows duplicates. Tuple: ordered, immutable — use it for data that shouldn't change, like coordinates. Set: unordered, no duplicates, fast membership checks (O(1) average). Dict: key-value pairs, fast lookups by key. Knowing when to reach for each one is the actual signal interviewers are looking for.
*args and **kwargs
*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dictionary. They let a function accept a flexible number of arguments without you having to define every possible parameter up front.
Common Python Interview Questions
What is a decorator? A function that wraps another function to extend its behavior without changing its code — using the @decorator_name syntax above a function definition. Common real-world example: a @login_required decorator on a web route that checks authentication before the route's actual logic runs.
Shallow copy vs. deep copy. A shallow copy (copy.copy()) creates a new outer object but still references the same nested objects inside it — change a nested list in the copy, and the original changes too. A deep copy (copy.deepcopy()) recursively copies everything, so the two are fully independent.
What is the GIL? The Global Interpreter Lock — a mutex in CPython (the standard Python implementation) that allows only one thread to execute Python bytecode at a time. This means threading doesn't give you true parallelism for CPU-bound work in Python; for that, you'd reach for the multiprocessing module instead, which uses separate processes rather than threads.
A Coding Question You Should Expect
Something achievable in 10–15 minutes: check if a string is a palindrome, count word frequency in a sentence, or find the missing number in a list of 1 to N. Bonus points for solving it with a clean list comprehension where it's genuinely more readable than a loop — but don't force one in just to show off the syntax.
Turn these Python questions into a daily habit
Get one question a day, answer in under 60 seconds, and watch your score improve over time.
Start Practicing FreeHow to Prepare
Practice explaining these concepts out loud in plain language — that's the actual interview skill, not just writing correct code silently. Run through questions like these in a live-scored AI Mock Interview, or drill one question a day with Flash Practice.
Frequently Asked Questions
What's the difference between mutable and immutable types in Python?expand_more
Lists, dictionaries, and sets are mutable and can be changed in place. Tuples, strings, and integers are immutable — any "change" creates a new object, which is why mutable default arguments like def f(x=[]) are a classic gotcha.
What is a decorator in Python?expand_more
A function that wraps another function to extend its behavior without changing its code, using @decorator_name syntax — a common example is a @login_required decorator that checks authentication before a route's logic runs.
What is the GIL and how does it affect threading?expand_more
The Global Interpreter Lock is a mutex in CPython that allows only one thread to execute Python bytecode at a time, so threading doesn't give true parallelism for CPU-bound work — the multiprocessing module is used instead for that.
What's the difference between a shallow copy and a deep copy?expand_more
A shallow copy creates a new outer object but still references the same nested objects inside it, so changing a nested list in the copy changes the original too. A deep copy recursively copies everything, making the two fully independent.
You Might Also Like