What type of relationship does the Composite pattern leverage to represent the parent-child structure?
Aggregation
Composition
Dependency
Inheritance
How does the Composite pattern promote code reusability?
By providing a common interface for interacting with simple and complex objects.
By encapsulating object creation logic.
By allowing objects to change their behavior at runtime.
By ensuring that a class has only one instance.
What is the primary purpose of the Builder Design Pattern?
To create objects without exposing the instantiation logic.
To provide a way to access elements of an aggregate object sequentially.
To ensure only one instance of a class exists.
To define a family of algorithms and encapsulate each one.
What is the primary purpose of the Iterator Pattern in software development?
To ensure that a class has only one instance and provides a global point of access to it.
To provide a way to access elements of an aggregate object sequentially without exposing its underlying representation.
To create objects from a class without specifying the exact class to create.
To define a family of algorithms, encapsulate each one, and make them interchangeable.
What could be a potential drawback of using the Flyweight pattern?
Slower performance because of the overhead of managing shared objects.
Increased memory consumption due to object duplication.
Limited flexibility in handling object variations and customizations.
Reduced code readability due to the separation of intrinsic and extrinsic state.
Which of the following is a key characteristic of a Proxy object in the Proxy Pattern?
It must implement a different interface than 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 provides an identical interface to the real subject object.
A Remote Proxy is typically used for:
Controlling access to the real subject based on user roles.
Creating a placeholder for an object that hasn't been fully loaded.
Providing a local representation of an object in a different process.
Caching the results of expensive operations for performance improvement.
Which principle of object-oriented design does the State Pattern primarily promote?
Single Responsibility Principle
Open/Closed Principle
Dependency Inversion Principle
Liskov Substitution Principle
Which core method is typically associated with the Prototype Pattern?
create()
clone()
copy()
getInstance()
What is the primary purpose of the Proxy Pattern in software design?
To allow objects to be notified of changes in other objects.
To provide a simplified interface to a complex subsystem.
To control access to an object, potentially restricting its use.