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
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?
How does DIP differ from "dependency injection" (DI)?
Which sentence best captures the Single Responsibility Principle (SRP)?
A `Penguin` class extends `Bird` and overrides `fly()` to throw `UnsupportedOperationException`. Which principle does this violate?
Which sentence best captures the Dependency Inversion Principle (DIP)?
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:
Which scenario is a textbook application of OCP rather than a violation?
What does the "S" in SOLID stand for?
Which pair of principles most often work together when applying the Strategy pattern?
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?
A `Cache` interface has `get`, `set`, `delete`, `keys`, `flush`, `stats`. A read-heavy consumer only ever uses `get`. Per ISP, the cleanest fix is:
A common downside of over-applying SOLID in a small codebase is: