Which of these scenarios is a good candidate for using the Proxy Pattern?
Defining a one-to-many dependency between objects.
Creating objects that are only instantiated when actually needed.
Iterating over a collection of objects without exposing its structure.
Representing a complex object hierarchy in a simplified manner.
Which of these scenarios best exemplifies the use of the Prototype Pattern?
Managing the state of a traffic light system.
Creating multiple instances of game characters with slightly varying attributes.
Implementing undo/redo functionality in a text editor.
Logging user actions in a system.
What is a potential drawback or consideration when using the Iterator Pattern?
It violates the Single Responsibility Principle.
It leads to tight coupling between classes.
Increased code complexity in some cases.
It is not suitable for all types of collections.
What is a key advantage of using a 'Flyweight Factory' in the pattern?
It simplifies the creation of complex Flyweight objects.
It provides a centralized point for accessing and managing extrinsic state.
It allows for dynamic loading and unloading of Flyweight objects.
It enforces the use of a single instance for each unique Flyweight.
What type of Proxy is used to control access to a resource based on access rights?
Caching Proxy
Virtual Proxy
Remote Proxy
Protection Proxy
How does the Prototype Pattern contribute to code flexibility?
It promotes loose coupling by reducing dependencies between classes.
It eliminates the need for inheritance.
It allows you to define new object types at runtime.
It simplifies the process of unit testing.
What is a key difference between a deep copy and a shallow copy in the context of the Prototype Pattern?
A deep copy is only applicable to immutable objects.
A deep copy is faster to execute than a shallow copy.
A shallow copy is preferred when you need to maintain object immutability.
A shallow copy duplicates references, while a deep copy creates new instances for nested objects.
In which scenario would the Prototype Pattern be LESS suitable?
When object creation is a lightweight operation.
When you want to avoid dependencies on concrete product classes.
When you have a large number of objects with minor variations.
When you need to create objects based on a configuration file at runtime.
In the State Pattern, what does the 'Context' class represent?
The concrete classes implementing different states.
The class that holds the current state of the object.
The interface or abstract class defining state-specific actions.
The mechanism for transitioning between states.
Which of these is NOT a potential benefit of using the Composite pattern?
Increased code complexity.
Open/Closed Principle adherence.
Uniform treatment of objects.
Flexibility in object structure.