Q: What is Python?
A: Python is a high-level, interpreted, general-purpose programming language known for its
simplicity, readability, and versatility. It supports multiple paradigms like object-oriented, functional,
and procedural programming.
Q: What are Python's key features?
A: Python is easy to learn, open-source, portable, dynamically typed, and has a large standard
library. It supports integration with other languages and rapid development.
Q: What is the difference between Python 2 and Python 3?
A: Python 3 uses Unicode by default, has improved syntax (e.g., print() as a function), better integer
division behavior, and more consistent libraries compared to Python 2.
Q: What are Python's basic data types?
A: Common data types include int, float, complex, str, list, tuple, dict, and set. These can be used to
store various forms of data in Python.
Q: What is the difference between mutable and immutable data types?
A: Mutable types (like lists and dicts) can be changed after creation, while immutable types (like
tuples and strings) cannot be modified once created.
Q: How are strings represented in Python?
A: Strings in Python are sequences of Unicode characters enclosed in single ('') or double quotes
(""). They support slicing, indexing, and a variety of built-in methods.
Q: How do you reverse a list in Python?
A: You can use the reverse() method or slicing: list[::-1]. Example: nums = [1,2,3]; print(nums[::-1])
→ [3,2,1].
Q: What is the difference between arguments and parameters in Python?
A: Parameters are variables in a function definition; arguments are the actual values passed during
a function call.
Q: What are *args and **kwargs used for?
A: *args is used to pass a variable number of positional arguments, and **kwargs is used for
keyword arguments. Example: def func(*args, **kwargs): print(args, kwargs)
Q: What is object-oriented programming in Python?
A: OOP allows you to structure programs around objects and classes. Python supports
encapsulation, inheritance, and polymorphism.
Q: What is the difference between a class and an object?
A: A class is a blueprint for creating objects. An object is an instance of a class containing data
(attributes) and functions (methods).
Q: What are decorators in Python?
A: Decorators are functions that modify the behavior of other functions or classes. Example:
@decorator_name before a function definition.
Q: What is the use of generators in Python?
A: Generators are iterators that yield one item at a time using the yield keyword. They save memory
and improve performance.
Q: What is the difference between deep and shallow copy?
A: A shallow copy copies references to objects, while a deep copy copies the objects recursively.
Use [Link]() and [Link]() respectively.
Note: This PDF contains a sample of the full set (~200) of Python interview questions with
explanations. More topics include File Handling, Exceptions, Multithreading, Data Science
Libraries, and Advanced Problem Solving.