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 **Strategy** pattern?

In this round
  1. Which best describes the **Strategy** pattern?
  2. ``` User u = new User.Builder() .name("Lena") .email("lena@example.com") .age(25) .build(); ``` Which pattern is this?
  3. What does "GoF" refer to in the design-pattern world?
  4. Which best describes the **Composite** pattern?
  5. 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?
  6. ``` Notifier n = new SlackNotifier(); n = new RetryDecorator(n); n = new LoggingDecorator(n); n.send("hello"); // logs, retries, then slacks ``` Which pattern is shown?
  7. Which best describes the **Observer** pattern?
  8. Which best describes the **Facade** pattern?
  9. ``` public class Config { private static Config instance; private Config() {} public static Config getInstance() { if (instance == null) instance = new Config(); return instance; } } ``` Which pattern is this?
  10. Which best describes the **Iterator** pattern?
  11. Why use design patterns at all?
  12. Which best describes the **Singleton** pattern?
Gaps to close?
Read the curated Design Patterns notes — core concepts, patterns, interview prep.
Design Patterns notes

More quizzes

.NETAccessibilityAgile MethodologyAlertmanagerAlgorithmsAndroid