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
Which best describes the **Strategy** pattern?
```
User u = new User.Builder()
.name("Lena")
.email("lena@example.com")
.age(25)
.build();
``` Which pattern is this?
What does "GoF" refer to in the design-pattern world?
Which best describes the **Composite** pattern?
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?
```
Notifier n = new SlackNotifier();
n = new RetryDecorator(n);
n = new LoggingDecorator(n);
n.send("hello"); // logs, retries, then slacks
``` Which pattern is shown?
Which best describes the **Observer** pattern?
Which best describes the **Facade** pattern?
```
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?