ProgrammingModerateAmazon/Microsoft SDE MCQ · Java placement

A Printer interface declares print(), scan(), fax() and staple(). A cheap printer class must implement all four and throws UnsupportedOperationException from three of them. Which SOLID principle is violated most directly?

  1. A. Single Responsibility Principle
  2. B. Open/Closed Principle
  3. C. Dependency Inversion Principle
  4. D. Interface Segregation Principle

Correct answer: D. Interface Segregation Principle

Interface Segregation says clients should not be forced to depend on methods they do not use; the fix is smaller role interfaces such as Printable and Scannable. Throwing from inherited operations also hurts substitutability, but the root cause is the fat interface.

More OOP with C++ and Java questions

Exams that ask this topic