Skip to content

Python Interview Questions for Freshers With Answers

The Python interview questions Indian companies actually ask freshers: data types, decorators, generators, OOP, plus coding patterns to practise.

4 min read
Illustration of a desk with a laptop and a small snake figurine around a coffee mug, representing a Python interview

Python interview questions for freshers cluster around a predictable set: data types and mutability, list vs tuple, decorators and generators, OOP basics, and a short live-coding problem. This guide covers the questions Indian service and product companies actually ask freshers, with short answers you can say out loud, plus the coding patterns to practise before the interview.

Core Python questions asked in almost every fresher interview

What is the difference between a list and a tuple?

Lists are mutable (you can change, add, remove elements); tuples are immutable. Tuples are faster to iterate and can be dictionary keys; lists cannot. Use a tuple when the data should not change, like coordinates or config values.

What are mutable and immutable types?

Immutable: int, float, str, tuple, frozenset. Mutable: list, dict, set. A classic trap: modifying a mutable default argument in a function persists across calls.

What is the difference between == and is?

== compares values; is compares identity (same object in memory). Python caches small integers and short strings, so is sometimes returns True unexpectedly - always compare values with ==.

What is a dictionary and how is it implemented?

A key-value store backed by a hash table, giving average O(1) lookup, insert, and delete. From Python 3.7, dictionaries preserve insertion order. Keys must be hashable (immutable).

Explain *args and **kwargs

*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dictionary. Used when a function must accept a variable number of inputs.

Intermediate questions that separate strong candidates

What is a decorator?

A function that takes another function and returns a wrapped version of it, adding behaviour without changing the original code. Common uses: logging, timing, authentication checks. Know the @ syntax and that it is just syntactic sugar for func = decorator(func).

What is a generator?

A function that uses yield to produce values lazily, one at a time, instead of building a full list in memory. Generators matter for large data: reading a 10GB log file line by line uses constant memory.

What is the difference between deep copy and shallow copy?

A shallow copy copies the outer object but shares references to nested objects; a deep copy recursively copies everything. Editing a nested list in a shallow copy changes the original too.

What are list comprehensions and why use them?

A compact way to build lists: [x*x for x in range(10) if x % 2 == 0]. Faster and more readable than an equivalent loop for simple transformations.

How does memory management work in Python?

Reference counting plus a cyclic garbage collector. When an object's reference count drops to zero, it is freed immediately; the GC handles reference cycles. Mentioning both shows you know more than the textbook line.

OOP questions freshers fumble

What is the difference between __init__ and __new__?

__new__ creates the object; __init__ initializes it. You almost always write __init__; __new__ appears in singletons and immutable-type subclassing.

What is method overriding vs overloading?

Overriding: a subclass redefines a parent method with the same signature - fully supported. Overloading: same name, different parameters - Python does not support it directly; use default arguments or *args.

What is self?

The instance the method is called on, passed explicitly as the first parameter. self is a convention, not a keyword, but never rename it.

Coding problems to practise

  • Reverse a string without slicing tricks (then explain why s[::-1] is still the best answer in practice).
  • Count character frequency in a string using a dictionary.
  • Find the second largest number in a list without sort().
  • Check if a string is a palindrome, ignoring case and spaces.
  • Flatten a nested list one level deep.

Pair this with our SQL interview questions guide - most fresher loops test both. If Python is your main skill, the Python developer resume format shows how to present projects that trigger these questions. Practise out loud with a mock interview before the real one.

Frequently asked questions

Which Python topics are most important for fresher interviews?

Data types and mutability, list vs tuple vs dict, string methods, OOP basics (class, inheritance, overriding), and one live-coding problem. Decorators and generators come up at product companies more than service companies.

Is DSA in Python asked in fresher interviews?

Yes. Arrays, strings, hashmaps, and basic recursion cover most fresher rounds. Python-specific questions usually come after the DSA problem, in the same round.

Should I mention Python 2 vs 3 differences?

Only if asked. Know the headline ones: print function, integer division, unicode strings by default. Python 2 is dead in production; interviewers ask to check whether you learned recently.

How do I answer "what projects have you built in Python"?

Pick one project, state the problem, your approach, one technical decision (why Flask over Django, why a dict over a list), and the outcome in numbers. Thirty seconds, then stop and let them dig in.

Are Python interviews for freshers hands-on or theoretical?

Both. Expect one written or shared-screen coding problem plus rapid-fire concept questions. Companies hiring for data roles add pandas and NumPy questions.

Sources

Found this useful? Send it on.

WhatsAppLinkedIn

Keep reading