Interview Q&A / Object-Oriented Programming
Object-Oriented Programming interview questions
The four pillars, interfaces, abstract classes and design basics.
Prefer rapid revision? Practise Object-Oriented Programming short interview answers →
- Explain the Interface Segregation Principle with a Worker interface example.
No class should be forced to implement methods it does not use. Split one big interface into small, focused ones so each class picks only what applies.
BeginnerQuick answer1 min read - How is the Interface Segregation Principle different from the Single Responsibility Principle?
SRP is about a class having one reason to change. ISP is about the interface a client sees: it should be small and fit that client's needs. One is about implementation, the other about the contract.
IntermediateQuick answer1 min read - Your interface has twelve methods and most implementers leave several empty. How do you fix it without breaking everything?
Introduce smaller role interfaces, make the big interface extend them, move clients to the small ones gradually, then retire the old one. Existing code keeps compiling throughout.
AdvancedQuick answer1 min read