All quizzes
Free quiz · 30 questions in the bank

SOLID Principles quiz

Test your SOLID Principles knowledge with a free interactive quiz — 30 questions with answers and explanations. No signup needed to play.

Question 1/12Score 0

You inject a `ConsoleLogger` everywhere. In production you want to swap it for a structured JSON logger without changing every call site. Which principle is at play?

In this round
  1. You inject a `ConsoleLogger` everywhere. In production you want to swap it for a structured JSON logger without changing every call site. Which principle is at play?
  2. How does DIP differ from "dependency injection" (DI)?
  3. Which sentence best captures the Single Responsibility Principle (SRP)?
  4. A `Penguin` class extends `Bird` and overrides `fly()` to throw `UnsupportedOperationException`. Which principle does this violate?
  5. Which sentence best captures the Dependency Inversion Principle (DIP)?
  6. A new junior on the team writes a 1500-line `God` class that handles parsing, validation, persistence, and notifications. The single SOLID principle most directly relevant is:
  7. Which scenario is a textbook application of OCP rather than a violation?
  8. What does the "S" in SOLID stand for?
  9. Which pair of principles most often work together when applying the Strategy pattern?
  10. An `IWorker` interface has methods `work()`, `eat()`, and `sleep()`. A `RobotWorker` implements it but leaves `eat()` and `sleep()` as no-ops. Which principle does this violate?
  11. A `Cache` interface has `get`, `set`, `delete`, `keys`, `flush`, `stats`. A read-heavy consumer only ever uses `get`. Per ISP, the cleanest fix is:
  12. A common downside of over-applying SOLID in a small codebase is:
Gaps to close?
Read the curated SOLID Principles notes — core concepts, patterns, interview prep.
SOLID Principles notes

More quizzes

.NETAccessibilityAgile MethodologyAirflowAlertmanagerAlgorithms