Design Patterns Exam Form
Design Patterns Exam Form
Which design pattern ensures a class has only one instance and provides a global access point to it?
*
Singleton
Factory Method
Decorator
Observer
Which pattern defines a family of related objects without specifying their concrete classes?
*
Abstract Factory
Builder
Prototype
Adapter
In the Observer pattern, what is the primary role of the subject?
*
It maintains observers and notifies them when its state changes.
It creates a family of related objects.
It converts one interface into another.
It encapsulates an algorithm for later selection.
Which pattern adds responsibilities to an object dynamically while keeping the same interface?
*
Decorator
Facade
Mediator
Memento
A client needs to work with a legacy component whose interface does not match the one it expects. Which pattern is most appropriate?
*
Adapter
Bridge
Composite
Flyweight
What problem does the Strategy pattern primarily address?
*
Selecting among interchangeable algorithms at runtime
Creating complex objects step by step
Providing a simplified interface to a subsystem
Notifying dependent objects of state changes
Which pattern provides a simplified interface to a complex subsystem?
*
Facade
Proxy
Chain of Responsibility
Visitor
Briefly describe a situation where the Factory Method pattern would be preferable to constructing objects directly.
*
Name one trade-off or potential drawback of using the Singleton pattern.
*
A notification system must support adding new notification channels without changing the publisher. Which pattern would you choose, and why?
*
Submit Exam
Should be Empty: