Python OOPS Interview Questions & Answers
Q: What is OOPS?
A: OOPS stands for Object-Oriented Programming System. It is a programming paradigm based on
objects and classes.
Q: What is a Class?
A: A class is a blueprint for creating objects. It defines variables and methods.
Q: What is an Object?
A: An object is an instance of a class that represents a real-world entity.
Q: What is Encapsulation?
A: Encapsulation is binding data and methods together and restricting direct access.
Q: What is Inheritance?
A: Inheritance allows a class to acquire properties and methods of another class.
Q: What is Polymorphism?
A: Polymorphism allows the same method name to have different behaviors.
Q: What is Abstraction?
A: Abstraction hides implementation details and shows only essential features.
Q: What is self?
A: self refers to the current object of the class.
Q: What is __init__?
A: __init__ is a constructor method automatically called during object creation.
Q: What is super()?
A: super() is used to call parent class methods or constructors.
Q: What is Method Overriding?
A: When a child class provides a specific implementation of a parent class method.
Q: What is Method Overloading?
A: Python does not support it directly, but it can be achieved using default arguments.
Q: What are access specifiers?
A: Public, Protected (_), and Private (__).
Q: What is MRO?
A: Method Resolution Order defines the order of method execution in inheritance.
Q: What is Duck Typing?
A: Duck typing focuses on object behavior rather than type.
Q: What is Composition?
A: Composition represents a HAS-A relationship between classes.
Q: Difference between is and ==
A: 'is' checks memory location, '==' checks value equality.
Q: Can Python support multiple inheritance?
A: Yes, Python supports multiple inheritance.
Q: Is Python pure OOPS?
A: No, Python is not purely object-oriented but supports OOPS concepts.
Q: What are magic methods?
A: Special methods starting and ending with double underscores.