Object-Oriented Programming Interview Questions
1. OOP Fundamentals
1. What is Object-Oriented Programming, and what problems does it solve?
How is OOP different from procedural programming?
What are the advantages and disadvantages of OOP?
When is OOP a good choice, and when might another paradigm be better?
2. What are the four main pillars of OOP?
What are Encapsulation, Abstraction, Inheritance, and Polymorphism?
How do these four concepts work together in real applications?
3. What is a class?
Why is a class often called a blueprint?
What can a class contain?
4. What is an object?
What is the difference between a class and an object?
What is an instance of a class?
Can multiple objects be created from the same class?
5. What is the difference between object state and object behavior?
How are fields/properties used to represent state?
How are methods used to represent behavior?
6. What is the difference between an instance variable and a class/static variable?
Which data belongs to each object?
Which data is shared among all objects?
7. What is the difference between an instance method and a class/static method?
Why can a static method usually not directly access instance data?
When should a method be static?
8. What is the difference between an object and a reference to an object?
Can multiple references point to the same object?
What happens when one reference modifies a shared mutable object?
2. Encapsulation and Abstraction
9. What is encapsulation?
Why is encapsulation important?
How does encapsulation reduce coupling?
Is encapsulation only about making variables private?
10. What is data hiding?
What is the difference between data hiding and encapsulation?
Can encapsulation exist without strict private fields?
11. What are access modifiers?
What is the difference between public, private, protected, and internal/package-private access?
Why do access rules differ across programming languages?
12. What are getters and setters?
Why are they used instead of direct field access?
Should every private field always have a getter and setter?
13. What is an immutable object?
How is immutability achieved?
What are the benefits of immutable objects?
Why are immutable objects useful in multithreaded systems?
14. What is abstraction?
What does "hide implementation details and expose essential behavior" mean?
How does abstraction reduce complexity?
15. What is the difference between abstraction and encapsulation?
Can abstraction and encapsulation work together?
Can you give an example where both concepts are used?
16. What is an abstract class?
Can an abstract class have a constructor?
Can it contain fields and concrete methods?
Can an abstract class exist without abstract methods?
Why can an abstract class usually not be instantiated?
17. What is an interface?
What problem does an interface solve?
How does an interface help achieve abstraction and loose coupling?
18. What is the difference between an interface and an abstract class?
When should you choose an interface?
When should you choose an abstract class?
Which is better for representing capabilities?
Which is better for sharing common state or implementation?
3. Inheritance and Object Relationships
19. What is inheritance?
What problem does inheritance solve?
What is a base/superclass?
What is a derived/subclass?