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.
In which scenarios is the Iterator Pattern particularly valuable?
When multiple algorithms need to operate on a collection without knowledge of its internal structure.
All of the above.
When the internal representation of a collection is subject to change.
When you want to provide a consistent way to traverse elements regardless of the collection type.
Which core method is typically associated with the Prototype Pattern?
getInstance()
create()
copy()
clone()
Which principle of object-oriented design does the Builder Pattern primarily promote?
Open/Closed Principle
Liskov Substitution Principle
Dependency Inversion Principle
Single Responsibility Principle
Which of these scenarios is a good candidate for using the Proxy Pattern?
Representing a complex object hierarchy in a simplified manner.
Creating objects that are only instantiated when actually needed.
Defining a one-to-many dependency between objects.
Iterating over a collection of objects without exposing its structure.
Which of these is a real-world scenario where the State Pattern is beneficial?
Validating user input in a form.
Sorting a list of elements in ascending order.
Representing the different stages of an order in an e-commerce system.
Implementing a simple counter.
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 duplicates references, while a deep copy creates new instances for nested objects.
A shallow copy is preferred when you need to maintain object immutability.
Which aspect of the Proxy Pattern implementation often involves using an interface?
The Proxy and the real subject implementing a common interface.
The Proxy dynamically loading the real subject using reflection.
The Proxy serializing and deserializing access to the real subject.
The client only interacting with the Proxy through an abstract factory.
Which of these situations is LEAST suitable for applying the Flyweight pattern?
Managing a large collection of immutable data points.
Representing characters in a document editor.
Creating graphical objects for a user interface with varying themes.
Implementing a particle system with thousands of visually similar particles.
What could be a potential drawback of applying the Composite pattern?
It violates the Single Responsibility Principle.
It can make it harder to restrict operations on specific component types.
It increases coupling between objects.
It makes adding new leaf objects difficult.