Free tutorials in Hindi & English Daily computer, mobile and IT guides Beginner friendly learning
Blog · Python · 04 Jul 2026 · Hindi + English

Top 15 Python Interview Questions for Freshers with Answers

15 most-asked Python interview questions for freshers: list vs tuple, == vs is, self, lambda, mutable types, decorators intro and tricky outputs.

How to use this list

These 15 questions cover what freshers are actually asked in campus placements and first-job interviews. Each answer is written the way you should say it — short, precise, with one example ready.

Basics (1–5)

Q1. What are Python's key features?

Interpreted (no compilation step), dynamically typed (no type declarations), object-oriented, huge standard library, and readable indentation-based syntax. Bonus: mention it is both scripting and general-purpose.

Q2. Difference between list and tuple?

List is mutable with [ ], tuple is immutable with ( ). Tuple is faster, uses less memory, and can be a dictionary key. Use tuple for fixed data like coordinates.

Q3. What is the difference between == and is?

== compares values, is compares identity (same object in memory). Use is only for None checks: if x is None.

Q4. What are mutable and immutable types?

Mutable: list, dict, set — change in place. Immutable: int, str, tuple — any change creates a new object. Prove it with id() before and after.

Q5. What is indentation in Python?

Python uses indentation (spaces) instead of { } to define code blocks. Standard is 4 spaces; inconsistent indentation raises IndentationError.

Functions and OOP (6–10)

Q6. What is a lambda function?

An anonymous one-line function: lambda x: x*x. One expression only, auto-returned. Best inside sorted(key=...), map() and filter().

Q7. What is self?

The reference to the current object. Python automatically passes the object before the dot as the first argument, and self receives it. It is a convention, not a keyword.

Q8. What is __init__?

The constructor method, called automatically when an object is created. It initializes the object's attributes: def __init__(self, name): self.name = name.

Q9. Difference between append() and extend()?

append adds its argument as one item (+1 length); extend adds each element of an iterable individually (+N length). a.append([4,5]) nests; a.extend([4,5]) doesn't.

Q10. What are *args and **kwargs?

*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dict. They let a function accept any number of arguments.

Tricky outputs (11–15)

Q11. Predict: print(3 * "ab")

Output: ababab — string repetition. Similarly [0] * 3 gives [0, 0, 0].

Q12. Predict: print(10 / 3, 10 // 3, 10 % 3)

Output: 3.3333333333333335 3 1 — / always returns float, // is floor division, % is remainder.

Q13. Predict:

a = [1, 2, 3]
b = a
b.append(4)
print(a)

Output: [1, 2, 3, 4] — b = a copies the reference, not the list. Both names share one object. To copy: b = a.copy() or b = a[:].

Q14. What is the output of bool("False")?

True! Any non-empty string is truthy — even the string "False". Only empty containers, 0, and None are falsy.

Q15. Predict:

def f(x, lst=[]):
    lst.append(x)
    return lst
print(f(1)); print(f(2))

Output: [1] then [1, 2] — the mutable default list is created once and shared across calls. Fix: default None, create list inside.

Last-minute revision line

If you remember only 5 things: list vs tuple (mutability), == vs is (value vs identity), self (current object), append vs extend (+1 vs +N), and the mutable default argument trap. These five cover more than half of all fresher Python questions.

इस list को कैसे use करें

ये 15 questions वही हैं जो freshers से campus placements और पहली job के interviews में असल में पूछे जाते हैं. हर answer वैसे लिखा है जैसे आपको बोलना चाहिए — छोटा, सटीक, एक example तैयार.

Basics (1–5)

Q1. Python की key features क्या हैं?

Interpreted (compilation step नहीं), dynamically typed (type declarations नहीं), object-oriented, विशाल standard library, और readable indentation-based syntax. Bonus: बताएं कि यह scripting और general-purpose दोनों है.

Q2. List और tuple में अंतर?

List mutable है [ ] के साथ, tuple immutable है ( ) के साथ. Tuple तेज़ है, कम memory लेता है, और dictionary key बन सकता है. Fixed data जैसे coordinates के लिए tuple use करें.

Q3. == और is में अंतर क्या है?

== values compare करता है, is identity (memory में same object). is सिर्फ None checks के लिए: if x is None.

Q4. Mutable और immutable types क्या हैं?

Mutable: list, dict, set — in place बदलते हैं. Immutable: int, str, tuple — कोई भी change नया object बनाता है. id() से before-after proof दें.

Q5. Python में indentation क्या है?

Python code blocks define करने के लिए { } की जगह indentation (spaces) use करता है. Standard 4 spaces है; inconsistent indentation पर IndentationError आता है.

Functions और OOP (6–10)

Q6. Lambda function क्या है?

Anonymous one-line function: lambda x: x*x. सिर्फ एक expression, auto-return. sorted(key=...), map() और filter() के अंदर best.

Q7. self क्या है?

Current object का reference. Python dot से पहले वाले object को automatically पहला argument बनाकर pass करता है, और self उसे receive करता है. यह convention है, keyword नहीं.

Q8. __init__ क्या है?

Constructor method, object बनते ही automatically call होता है. यह object के attributes initialize करता है: def __init__(self, name): self.name = name.

Q9. append() और extend() में अंतर?

append argument को एक item की तरह जोड़ता है (+1 length); extend iterable के हर element को अलग-अलग (+N length). a.append([4,5]) nest करता है; a.extend([4,5]) नहीं.

Q10. *args और **kwargs क्या हैं?

*args extra positional arguments को tuple में collect करता है; **kwargs extra keyword arguments को dict में. इनसे function कितने भी arguments accept कर सकता है.

Tricky outputs (11–15)

Q11. Predict: print(3 * "ab")

Output: ababab — string repetition. वैसे ही [0] * 3 देता है [0, 0, 0].

Q12. Predict: print(10 / 3, 10 // 3, 10 % 3)

Output: 3.3333333333333335 3 1 — / हमेशा float देता है, // floor division है, % remainder.

Q13. Predict:

a = [1, 2, 3]
b = a
b.append(4)
print(a)

Output: [1, 2, 3, 4] — b = a reference copy करता है, list नहीं. दोनों names एक object share करते हैं. Copy के लिए: b = a.copy() या b = a[:].

Q14. bool("False") का output क्या है?

True! कोई भी non-empty string truthy है — string "False" भी. सिर्फ empty containers, 0, और None falsy हैं.

Q15. Predict:

def f(x, lst=[]):
    lst.append(x)
    return lst
print(f(1)); print(f(2))

Output: [1] फिर [1, 2] — mutable default list एक बार बनकर सभी calls में share होती है. Fix: default None, list अंदर बनाएं.

Last-minute revision line

सिर्फ 5 चीज़ें याद रखनी हों तो: list vs tuple (mutability), == vs is (value vs identity), self (current object), append vs extend (+1 vs +N), और mutable default argument trap. ये पांच freshers के आधे से ज़्यादा Python questions cover करते हैं.

Frequently Asked Questions

What are the most asked Python interview questions for freshers?

The top repeats are: list vs tuple, == vs is, what is self, mutable vs immutable types, append vs extend, lambda functions and the mutable default argument trap.

What is the output of bool("False") in Python?

True, because any non-empty string is truthy in Python — only empty strings, empty containers, 0 and None are falsy.

How should freshers prepare Python for interviews?

Master core data types and their differences, practice 20-30 output-prediction questions, and be able to write small programs like palindrome and factorial without looking anything up.