Quiz: Design Patterns Questions
Browse questions from Quiz: Design Patterns. Each question has options and an explanation.
Questions — Page 1 of 2
- Which pattern is best for constructing an immutable object with many optional fields?
- The Builder pattern is useful when an object has many optional constructor parameters.
- Which pattern wraps an incompatible legacy API behind the interface your app expects?
- The Adapter pattern is mainly used to enforce exactly one object instance.
- Which pattern adds behavior such as logging or caching around an object without changing the object's class?
- Decorator favors composition over modifying the original class.
- What is the biggest risk of forcing design patterns into simple code?
- Every Java class should use at least one named design pattern.
- A payment provider changed its SDK method names, but your application wants to keep using the same PaymentGateway interface. Which pattern fits best?
- A request DTO has many optional fields and constructors are becoming unreadable. Which pattern should you reach for first?