Python backend interviews cover language internals, async programming, Django or FastAPI, and database access patterns. Below are the most common questions with model answers. Junior: core theory, definitions, and simple practical cases.
1
What is the difference between a list and a tuple, and when does it matter?
Answer
Lists are mutable, tuples are not, and the consequence people forget is that immutability makes tuples hashable — so a tuple can be a dictionary key and a list cannot. Use a tuple when the size and meaning of each position are fixed, like a coordinate or a database row, and a list when you are collecting items of the same kind. A tuple also signals intent: it tells the reader nobody is going to append to this.
2
What happens if you use a mutable object as a default argument?
Answer
The default is evaluated once, when the function is defined, not on each call — so a list or dict default is shared by every call and accumulates state between them. The fix is to default to None and build the object inside the body. This is the single most common Python bug that survives code review, because the function looks correct in isolation.
3
What is the difference between is and ==?
Answer
== asks whether two objects have the same value; is asks whether they are the same object in memory. They agree by accident for small integers and short strings because CPython caches those, which is why the mistake goes unnoticed until a value grows past the cache. The rule in practice: use is only for None, True and False, and == for everything else.
4
Explain how a dictionary finds a key.
Answer
It hashes the key to pick a bucket, then compares with equality to resolve collisions inside that bucket. Two consequences follow: the key must be hashable, which is why a list cannot be one, and if you override __eq__ on a class you must override __hash__ too, or instances that compare equal will land in different buckets and behave incorrectly in sets and dicts.
5
What is the difference between a list comprehension and a generator expression?
Answer
A comprehension in square brackets builds the whole list in memory immediately; the same expression in parentheses returns a generator that yields items one at a time. For a million rows the first allocates a million objects and the second allocates one at a time. Use the generator when you are iterating once and the comprehension when you need the result more than once or need its length.
6
What does try / except / else / finally each do?
Answer
try holds the risky code, except handles a specific exception, else runs only if nothing was raised, and finally runs either way and is where cleanup goes. else exists so that the try block stays as small as possible — code that cannot fail does not belong in it, because a broad except would then swallow errors from lines you never meant to guard.
7
What do *args and **kwargs do?
Answer
*args collects extra positional arguments into a tuple, **kwargs collects extra keyword arguments into a dict. They are what lets a wrapper accept any signature and pass it through unchanged, which is why every decorator you will write uses them. Overusing them in ordinary functions hides the real signature from readers and from type checkers.
🦎
Reading answers is not enough
In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.
Practice a Junior Python Backend interview →Free · 3 interviews per month