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

What does "GoF" refer to in the design-pattern world?

Questions in this quiz
  1. What does "GoF" refer to in the design-pattern world?
  2. Which best describes the **Strategy** pattern?
  3. Which best describes the **Iterator** pattern?
  4. When should you reach for a design pattern?
  5. Which best describes the **Factory Method** pattern?
  6. Which three categories does the GoF catalog organize patterns into?
  7. Why use design patterns at all?
  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. ``` 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?
  10. ``` 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?
  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. 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

.NET.NET MAUIAbsintheAccessibilityActixActix Web