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 directly copying object properties.
By implementing the Cloneable interface.
Cloneable
How does the Iterator Pattern handle situations where the underlying collection might be modified during iteration?
It creates a copy of the collection to ensure data integrity during iteration.
It generally does not handle this directly; safeguards like concurrent modification exceptions might be needed.
It relies on the client code to manage synchronization and prevent issues.
It automatically prevents any modifications to the collection while iteration is in progress.
What is a key advantage of using a 'Flyweight Factory' in the pattern?
It provides a centralized point for accessing and managing extrinsic state.
It enforces the use of a single instance for each unique Flyweight.
It simplifies the creation of complex Flyweight objects.
It allows for dynamic loading and unloading of Flyweight objects.
Which of these situations is LEAST suitable for applying the Flyweight pattern?
Creating graphical objects for a user interface with varying themes.
Implementing a particle system with thousands of visually similar particles.
Managing a large collection of immutable data points.
Representing characters in a document editor.
What is the primary purpose of the Proxy Pattern in software design?
To define a family of algorithms and encapsulate each one.
To control access to an object, potentially restricting its use.
To allow objects to be notified of changes in other objects.
To provide a simplified interface to a complex subsystem.
Which principle of object-oriented design does the State Pattern primarily promote?
Dependency Inversion Principle
Liskov Substitution Principle
Open/Closed Principle
Single Responsibility Principle
How does the Builder Pattern differ from using telescoping constructors?
The Builder Pattern provides better control and clarity when building objects with many attributes.
Telescoping constructors are more readable for a large number of attributes.
The Builder Pattern is less flexible when dealing with optional attributes.
Telescoping constructors are preferred when the object construction is complex.
Which core method is typically associated with the Prototype Pattern?
create()
clone()
copy()
getInstance()
Which principle of object-oriented design does the Iterator Pattern promote by decoupling the traversal mechanism from the aggregate object?
Which of the following is a key characteristic of a Proxy object in the Proxy Pattern?
It cannot modify the behavior of the real subject object.
It must implement a different interface than the real subject object.
It always has direct access to the real subject object.
It provides an identical interface to the real subject object.