Which of the following is a key characteristic of a Proxy object in the Proxy Pattern?
It provides an identical interface to the real subject object.
It cannot modify the behavior of the real subject object.
It always has direct access to the real subject object.
It must implement a different interface than the real subject object.
In a language like Java, how is object cloning often achieved within the Prototype Pattern?
By using the Object.assign() method.
Object.assign()
By using the spread operator.
spread
By implementing the Cloneable interface.
Cloneable
By directly copying object properties.
Which principle of object-oriented design does the Builder Pattern primarily promote?
Dependency Inversion Principle
Liskov Substitution Principle
Single Responsibility Principle
Open/Closed Principle
In a typical Iterator Pattern implementation, what is the role of the 'ConcreteIterator' class?
It creates objects without exposing the instantiation logic to the client.
It represents the collection of objects being iterated over.
It defines the interface for accessing and traversing elements.
It implements the Iterator interface and provides the concrete implementation for iterating over a specific aggregate object.
What is the primary purpose of the Proxy Pattern in software design?
To allow objects to be notified of changes in other objects.
To define a family of algorithms and encapsulate each one.
To provide a simplified interface to a complex subsystem.
To control access to an object, potentially restricting its use.
What is the primary goal of the State Pattern in object-oriented programming?
To manage and transition between different states of an object.
To provide a way to access elements of an aggregate object sequentially.
To create objects without specifying their concrete classes.
Which of the following is NOT a core participant in the Iterator Pattern?
ConcreteIterator
Factory
Aggregate
Iterator
What is a key advantage of encapsulating state-specific behavior in separate classes in the State Pattern?
It eliminates the need for interfaces or abstract classes.
It improves code organization and allows for easier addition of new states.
It reduces the number of classes needed compared to other patterns.
It makes the code more concise and harder to understand.
In the Flyweight pattern, what is the role of the 'intrinsic state'?
Data that is common to multiple objects and can be shared.
An interface that defines operations for interacting with Flyweights.
A factory method that creates and manages Flyweight objects.
Data that is unique to each object and cannot be shared.
In the State Pattern, what does the 'Context' class represent?
The mechanism for transitioning between states.
The concrete classes implementing different states.
The interface or abstract class defining state-specific actions.
The class that holds the current state of the object.