All quizzes
Free quiz · 50 questions in the bank

Design Patterns quiz

Test your Design Patterns knowledge with a free interactive quiz — 50 questions with answers and explanations. No signup needed to play.

Question 1/12Score 0

Which best describes the **Adapter** pattern?

In this round
  1. Which best describes the **Adapter** pattern?
  2. Which best describes the **Strategy** pattern?
  3. Why use design patterns at all?
  4. ``` button.addEventListener("click", () => save()); button.addEventListener("click", () => analytics.log("save")); ``` Which design pattern does the browser event system implement?
  5. Which best describes the **Builder** pattern?
  6. ``` interface Notification { void send(); } abstract class Notifier { abstract Notification create(); void notify() { create().send(); } } class EmailNotifier extends Notifier { Notification create() { return new EmailNotification(); } } ``` Which pattern is this?
  7. What is an "anti-pattern"?
  8. A drawing app has `Shape.draw()` — `Circle` and `Square` draw themselves, and `Group` (which contains a list of `Shape`s) iterates over its children and calls `draw()` on each. Client code calls `shape.draw()` without caring whether it's a single shape or a group. Which pattern is this?
  9. What is the difference between **Factory Method** and **Abstract Factory**?
  10. ``` User u = new User.Builder() .name("Lena") .email("lena@example.com") .age(25) .build(); ``` Which pattern is this?
  11. ``` Notifier n = new SlackNotifier(); n = new RetryDecorator(n); n = new LoggingDecorator(n); n.send("hello"); // logs, retries, then slacks ``` Which pattern is shown?
  12. Your app expects `Logger.log(msg)` but the new 3rd-party SDK exposes `extLogger.write(level, text)`. You build a `ThirdPartyLoggerAdapter` that exposes `log(msg)` and internally calls `extLogger.write("info", msg)`. Which pattern is this?
Gaps to close?
Read the curated Design Patterns notes — core concepts, patterns, interview prep.
Design Patterns notes

More quizzes

.NETAccessibilityAgile MethodologyAlertmanagerAlgorithmsAndroid