gitGood.dev

Object-Oriented Design Interview Questions

Practice OOD concepts including SOLID principles, design patterns, inheritance, polymorphism, and real-world system modeling.

32
Total Questions
9
Easy
20
Medium
3
Hard
Showing 1-20 of 32 questionsPage 1 of 2
Sign up to start practicing these questionsSign up free →
Single Responsibility Principle
QuizEasy
Singleton Pattern
QuizMedium
Composition vs Inheritance
QuizMedium
Dependency Injection
QuizHard
Liskov Substitution Principle
QuizHard
Interface Segregation Principle
QuizMedium
Factory Pattern
QuizMedium
Observer Pattern
QuizMedium
Strategy Pattern
QuizMedium
JavaScript Prototypes
QuizHard
What is Encapsulation?
QuizEasy
Inheritance vs Composition Basics
QuizEasy
What is Polymorphism?
QuizEasy
Interface vs Abstract Class
QuizEasy
Code Review Priorities
QuizEasy
API Design Principles
QuizMedium
Dependency Vulnerability Response
QuizEasy
Single Responsibility Principle
QuizEasy
Composition vs Inheritance
QuizMedium
Factory Pattern Usage
QuizMedium

Frequently Asked Questions

How are OOD interviews different from coding interviews?

OOD interviews focus on designing class hierarchies, identifying objects and their relationships, and applying design patterns. You model real-world systems using classes rather than writing algorithms. Common prompts include designing a parking lot, library system, or elevator system.

Which design patterns should I know for interviews?

Focus on Singleton, Factory, Observer, Strategy, Decorator, and Adapter patterns. Understanding SOLID principles (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) is equally important.

What are the SOLID principles?

Single Responsibility (one reason to change), Open-Closed (open for extension, closed for modification), Liskov Substitution (subtypes must be substitutable), Interface Segregation (prefer small interfaces), and Dependency Inversion (depend on abstractions, not concretions). These guide maintainable OO design.

When should I use composition over inheritance?

Prefer composition when you need flexibility, want to avoid deep inheritance hierarchies, or when the relationship is 'has-a' rather than 'is-a'. Composition allows swapping behaviors at runtime and avoids the fragile base class problem. Modern best practice favors composition in most cases.

How do I approach an OOD interview question?

Start by clarifying requirements and scope. Identify the main objects and their attributes. Define relationships (inheritance, composition, association). Design the core methods and interfaces. Apply relevant design patterns. Discuss trade-offs and how the design handles edge cases.

What is the difference between abstract classes and interfaces?

Abstract classes can have implemented methods and state, and a class can only inherit one. Interfaces define method signatures only (though modern languages allow default implementations), and a class can implement multiple. Use abstract classes for shared behavior and interfaces for defining contracts.

Explore Other Categories