🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: SOLID Principles: all 10 questions

Quiz: SOLID Principles · Question 5 of 10

A BasicPrinter class implements a Machine interface and raises an error in scan() and fax(). What is the best fix?

A BasicPrinter class implements a Machine interface and raises an error in scan() and fax(). What is the best fix?

  1. A.Catch the errors in every caller
  2. B.Add more methods to Machine
  3. C.Make BasicPrinter extend Scanner
  4. D.Split Machine into smaller interfaces such as Printer, Scanner and Fax
Answer & explanation

Correct answer: Split Machine into smaller interfaces such as Printer, Scanner and Fax

Interface Segregation: a class should only depend on methods it actually uses.

Can you get the rest right without peeking?

Take the timed Quiz: SOLID Principles quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →