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/5Score 0

``` User u = new User.Builder() .name("Lena") .email("lena@example.com") .age(25) .build(); ``` Which pattern is this?

Questions in this quiz
  1. ``` User u = new User.Builder() .name("Lena") .email("lena@example.com") .age(25) .build(); ``` Which pattern is this?
  2. ``` interface Compressor { byte[] compress(byte[] data); } class GzipCompressor implements Compressor { ... } class ZstdCompressor implements Compressor { ... } class Backup { Backup(Compressor c) { this.c = c; } void run(byte[] data) { storage.write(c.compress(data)); } } ``` Which pattern is this?
  3. Which three categories does the GoF catalog organize patterns into?
  4. Which best describes the **Builder** pattern?
  5. ``` Notifier n = new SlackNotifier(); n = new RetryDecorator(n); n = new LoggingDecorator(n); n.send("hello"); // logs, retries, then slacks ``` Which pattern is shown?
  6. What does "GoF" refer to in the design-pattern world?
  7. Which best describes the **Iterator** pattern?
  8. What is the difference between **Factory Method** and **Abstract Factory**?
  9. Which best describes the **Adapter** pattern?
  10. 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?
  11. ``` button.addEventListener("click", () => save()); button.addEventListener("click", () => analytics.log("save")); ``` Which design pattern does the browser event system implement?
  12. What is an "anti-pattern"?
Gaps to close?
Read the curated Design Patterns notes — core concepts, patterns, interview prep.
Design Patterns notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web