How does the State Pattern typically handle state transitions?
State transitions are determined by external events only.
A separate 'State Manager' class controls all transitions.
The 'Context' object directly modifies its internal state.
State objects have methods to trigger transitions to other states.
What is a key advantage of encapsulating state-specific behavior in separate classes in the State Pattern?
It improves code organization and allows for easier addition of new states.
It makes the code more concise and harder to understand.
It eliminates the need for interfaces or abstract classes.
It reduces the number of classes needed compared to other patterns.
What is the primary intent of the Composite Design Pattern?
To treat individual objects and compositions of objects uniformly.
To ensure a class has only one instance.
To provide a way to access the elements of an aggregate object sequentially.
To define a family of algorithms, encapsulate each one, and make them interchangeable.
Which of the following is NOT a core participant in the Iterator Pattern?
Iterator
ConcreteIterator
Factory
Aggregate
What is the primary goal of the Flyweight pattern?
To minimize memory usage by sharing common data among multiple objects.
To encapsulate algorithms in objects, allowing for easy swapping and extension.
To provide a way to access shared objects in a synchronized manner.
Which of these relationships best describes the Composite pattern?
Association
Both Inheritance and Composition
Realization
Inheritance
In the Flyweight pattern, what is the role of the 'intrinsic state'?
Data that is common to multiple objects and can be shared.
A factory method that creates and manages Flyweight objects.
Data that is unique to each object and cannot be shared.
An interface that defines operations for interacting with Flyweights.
Which of these real-world scenarios could benefit from applying the Iterator Pattern?
Processing a stream of data from a sensor network.
Representing a menu structure in a graphical user interface.
Navigating through a playlist of songs in a music player.
All of the above.
What could be a potential drawback of applying the Composite pattern?
It can make it harder to restrict operations on specific component types.
It violates the Single Responsibility Principle.
It makes adding new leaf objects difficult.
It increases coupling between objects.
Which real-world scenario is well-suited for the Composite pattern?
Implementing an undo/redo mechanism.
Creating a thread-safe singleton object.
Managing a database connection pool.
Representing a file system with directories and files.