Object-Oriented Programming · Question 24 · Medium

Which SOLID principle says a class should have only one reason to change?

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

Answer: B. Single Responsibility Principle

Explanation: The Single Responsibility Principle: a class should do one job, so only one kind of requirement change forces it to change. Open/Closed is about extending without modifying; Interface Segregation prefers small interfaces; Dependency Inversion depends on abstractions.

Previous: What is the output of the following Python code? · Next: Which design pattern ensures that a class has only one instance and provides a…

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