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

``` 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?

In this round
  1. ``` 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?
  2. Why use design patterns at all?
  3. ``` User u = new User.Builder() .name("Lena") .email("lena@example.com") .age(25) .build(); ``` Which pattern is this?
  4. ``` 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?
  5. Which best describes the **Observer** pattern?
  6. Which best describes the **Composite** pattern?
  7. What does "GoF" refer to in the design-pattern world?
  8. Which best describes the **Singleton** pattern?
  9. What is a "design pattern" in software engineering?
  10. Which best describes the **Iterator** pattern?
  11. Which best describes the **Factory Method** pattern?
  12. Which three categories does the GoF catalog organize patterns into?
Gaps to close?
Read the curated Design-patterns notes — core concepts, patterns, interview prep.
Design-patterns notes

More quizzes

AccessibilityAlgorithmsAngularApache KafkaAWSBootstrap