Why interviewers ask this
It tests core programming concepts common in many languages.
How to approach it
Name encapsulation, abstraction, inheritance and polymorphism and give a tiny example for each.
Example answer
Encapsulation hides data behind methods, abstraction exposes only what is needed, inheritance reuses behaviour from a parent class, and polymorphism lets different classes respond to the same method differently.
What a weak answer sounds like
OOP is about classes and objects.
It is vague, has no example and gives the interviewer nothing to remember.
A simple structure for your answer
- Name the four pillars
- Give a one-line example for each
- Relate one to a project you built
- Mention a limit, such as deep inheritance trees
Freshers and experienced candidates
Freshers can use classroom examples; experienced candidates should talk about design trade-offs.
Common mistake
Listing the terms with no examples.
Self-check before the interview
Do your examples come from real code, not only the textbook animal and vehicle examples?
Follow-up questions to expect
- Give an example of polymorphism in a project.
- What is the difference between abstraction and encapsulation?
- When would you prefer composition over inheritance?
How to practise
Explain each pillar using an example from a project you have actually built.
Use this as a pattern, not a script. Answer in your own words with your own examples.