Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 2.97 KB

File metadata and controls

71 lines (57 loc) · 2.97 KB

OOPS Interview Questions (Topic-wise, 50 Questions)

Class & Object

  1. What is a class in Object-Oriented Programming?
  2. What is an object? How is it different from a class?
  3. What is the difference between a class variable and an instance variable?
  4. How do you create an object in Python?
  5. What is the __init__ method and why is it used?
  6. Can a class exist without creating an object? Explain with an example.
  7. What is the difference between a class method and a static method?
  8. What is the purpose of the self keyword in Python classes?
  9. How do you delete an object in Python?
  10. What is the difference between object identity and object equality?

Inheritance

  1. What is inheritance in OOP?
  2. What are the types of inheritance supported in Python?
  3. What is the difference between single and multiple inheritance?
  4. How do you call a parent class constructor in a derived class?
  5. What is method overriding in inheritance?
  6. Can a child class access private members of the parent class?
  7. What is the role of the super() function in inheritance?
  8. What is hierarchical inheritance? Provide a real-world example.
  9. What is hybrid inheritance? Is it supported in Python?
  10. How does Python handle the Diamond Problem in multiple inheritance?

Polymorphism

  1. What is polymorphism in OOP?
  2. What is the difference between compile-time and runtime polymorphism?
  3. How is method overloading achieved in Python?
  4. What is method overriding? Provide an example.
  5. What is duck typing in Python?
  6. What is operator overloading? Provide an example.
  7. Can two methods have the same name with different return types in Python?
  8. What is the __str__() method used for in polymorphism?
  9. What is dynamic dispatch in Python?
  10. What is the difference between polymorphism and inheritance?

Encapsulation & Abstraction

  1. What is encapsulation in OOP?
  2. How do you achieve encapsulation in Python?
  3. What is the difference between public, private, and protected members in Python?
  4. What is abstraction in OOP?
  5. How do you achieve abstraction in Python?
  6. What is the difference between encapsulation and abstraction?
  7. Can abstraction be achieved without encapsulation?
  8. Why do we use name mangling (e.g., __var) in Python?
  9. What are getter and setter methods?
  10. What is the use of the @property decorator in Python?

Constructors & Destructors

  1. What is a constructor in OOP?
  2. What is the difference between default and parameterized constructors?
  3. How many constructors can a class have in Python?
  4. What is a destructor in Python and when is it called?
  5. What happens if you explicitly delete an object in Python?

Advanced OOP Concepts

  1. What is an abstract class? How do you define one in Python?
  2. What is an interface? Does Python support interfaces?
  3. What are the SOLID principles in Object-Oriented Design?
  4. What is dependency injection in OOP?
  5. What is multiple dispatch and how is it implemented in Python?