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
```
User u = new User.Builder()
.name("Lena")
.email("lena@example.com")
.age(25)
.build();
``` Which pattern is this?
```
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?
Which three categories does the GoF catalog organize patterns into?
Which best describes the **Builder** pattern?
```
Notifier n = new SlackNotifier();
n = new RetryDecorator(n);
n = new LoggingDecorator(n);
n.send("hello"); // logs, retries, then slacks
``` Which pattern is shown?
What does "GoF" refer to in the design-pattern world?
Which best describes the **Iterator** pattern?
What is the difference between **Factory Method** and **Abstract Factory**?
Which best describes the **Adapter** pattern?
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?
```
button.addEventListener("click", () => save());
button.addEventListener("click", () => analytics.log("save"));
``` Which design pattern does the browser event system implement?