Python Interview Questions & Answers (100+)
Q: What are the key features of Python?
A: Python is interpreted, dynamically typed, object-oriented, and has simple syntax. It supports
multiple paradigms and has a vast standard library.
Q: What are Python’s data types?
A: Common data types include int, float, complex, str, list, tuple, set, frozenset, dict, bool,
NoneType.
Q: What is the difference between list and tuple?
A: Lists are mutable, tuples are immutable. Tuples are generally faster and can be used as keys in
dictionaries.
Q: What is the difference between ‘is’ and ‘==’?
A: ‘is’ checks identity (whether two objects point to the same memory), while ‘==’ checks value
equality.
Q: What is Python’s GIL?
A: The Global Interpreter Lock ensures only one thread executes Python bytecode at a time. It
simplifies memory management but limits true parallelism in threads.
Q: What is a decorator in Python?
A: A decorator is a function that modifies another function or method. Commonly used for logging,
authentication, and memoization.
Q: What are *args and **kwargs?
A: *args allows variable-length positional arguments; **kwargs allows variable-length keyword
arguments.
Q: What is the difference between deep copy and shallow copy?
A: Shallow copy copies references of objects (changes reflect in original), deep copy creates
completely independent copies.
Q: What is the difference between Python 2 and Python 3?
A: Python 3 uses print() as a function, supports Unicode by default, integer division returns float,
and has better library support.
Q: What are Python comprehensions?
A: Comprehensions provide concise syntax for creating lists, sets, and dictionaries using loops and
conditions.
More Questions...
This PDF contains 100+ commonly asked Python interview questions with short answers for quick
revision.