🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: SOLID in Java: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. In the original ResultService.publish(), how many different reasons to change did the class have?
  2. Q2. A PaymentProcessor has if (type.equals("UPI")) … else if (type.equals("CARD")) …. Adding NetBanking needs another else if. Which principle…
  3. Q3. What does this print? (code)
  4. Q4. A subclass overrides a method and throws UnsupportedOperationException. Which principle is most likely broken?
  5. Q5. Why is ResultService(ResultStore store, Notifier notifier) easier to test than a class that does new MySqlStore() inside?
  6. Q6. An interface has print(), scan() and fax(). A basic printer must implement all three. What is the best fix?
  7. Q7. What does this print? (code)
  8. Q8. Dependency Inversion says high-level modules should depend on:
  9. Q9. Which statement about Dependency Injection is correct?
  10. Q10. When is applying SOLID strictly NOT worth it?