Which principle of object-oriented design does the Iterator Pattern promote by decoupling the traversal mechanism from the aggregate object?
Dependency Inversion Principle
Single Responsibility Principle
Liskov Substitution Principle
Open/Closed Principle
In the Flyweight pattern, what is the role of the 'intrinsic state'?
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.
Data that is common to multiple objects and can be shared.
In the Builder Pattern, what is the product?
The concrete builder class that assembles the object.
The complex object being constructed.
The director class that orchestrates the building process.
The interface that defines the building steps.
In which scenarios is the Iterator Pattern particularly valuable?
When multiple algorithms need to operate on a collection without knowledge of its internal structure.
When you want to provide a consistent way to traverse elements regardless of the collection type.
When the internal representation of a collection is subject to change.
All of the above.
Which of these situations is LEAST suitable for applying the Flyweight pattern?
Creating graphical objects for a user interface with varying themes.
Managing a large collection of immutable data points.
Implementing a particle system with thousands of visually similar particles.
Representing characters in a document editor.
In which scenario would the Prototype Pattern be LESS suitable?
When you have a large number of objects with minor variations.
When object creation is a lightweight operation.
When you want to avoid dependencies on concrete product classes.
When you need to create objects based on a configuration file at runtime.
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.
Which principle of object-oriented design does the Builder Pattern primarily promote?
In the State Pattern, what does the 'Context' class represent?
The interface or abstract class defining state-specific actions.
The class that holds the current state of the object.
The concrete classes implementing different states.
The mechanism for transitioning between states.
What is the primary purpose of the Builder Design Pattern?
To ensure only one instance of a class exists.
To provide a way to access elements of an aggregate object sequentially.
To create objects without exposing the instantiation logic.
To define a family of algorithms and encapsulate each one.