Object-Oriented Programming · Question 15 · Medium

Object-Oriented Programming question 15

Which SOLID principle states that objects of a subclass should be usable wherever objects of the base class are expected, without breaking the program's correctness?

  1. Open/Closed Principle
  2. Interface Segregation Principle
  3. Dependency Inversion Principle
  4. Liskov Substitution Principle
Answer and explanation

Answer: D. Liskov Substitution Principle

Explanation: The Liskov Substitution Principle requires subtypes to be substitutable for their base types. Open/Closed is about being open for extension but closed for modification.

Previous: What is the output of the following Java code? · Next: A Logger class keeps a list of log entries in a private field and offers only…

Practise object-oriented programming

Try a fresh set of object-oriented programming questions with an explanation after every answer, free and without signing up: Object-Oriented Programming practice. Or sit a full placement mock test.

More object-oriented programming questions

More technical & programming practice

DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics · Pseudo-code

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge