In the context of the Proxy Pattern, what does the term 'subject' refer to?
The object being accessed through the proxy.
The object that controls access to the real object.
The interface shared by the proxy and the real object.
The client that interacts with the proxy or the real object.
What is the primary goal of the State Pattern in object-oriented programming?
To provide a way to access elements of an aggregate object sequentially.
To manage and transition between different states of an object.
To create objects without specifying their concrete classes.
To define a family of algorithms and encapsulate each one.
What is the primary goal of the Prototype Pattern?
To avoid costly creation of objects by copying existing ones.
To ensure a class has only one instance.
To define a family of algorithms, encapsulate each one, and make them interchangeable.
What is a potential drawback or consideration when using the Prototype Pattern?
It can make the codebase overly complex.
It might lead to shallow copies of objects if not implemented carefully.
It violates the Single Responsibility Principle.
It is not suitable for languages that do not support object-oriented programming.
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.
An interface that defines operations for interacting with Flyweights.
Data that is unique to each object and cannot be shared.
Which real-world scenario is well-suited for the Composite pattern?
Managing a database connection pool.
Implementing an undo/redo mechanism.
Representing a file system with directories and files.
Creating a thread-safe singleton object.
What type of relationship does the Composite pattern leverage to represent the parent-child structure?
Dependency
Aggregation
Composition
Inheritance
Which principle of object-oriented design does the State Pattern primarily promote?
Open/Closed Principle
Dependency Inversion Principle
Liskov Substitution Principle
Single Responsibility Principle
How does a Virtual Proxy primarily enhance performance?
By storing copies of frequently accessed data to avoid repeated retrieval.
By restricting access to the real subject based on user permissions.
By delaying the creation of expensive objects until they are actually needed.
By providing a simplified representation of a complex object structure.
How does the Prototype Pattern contribute to code flexibility?
It allows you to define new object types at runtime.
It simplifies the process of unit testing.
It promotes loose coupling by reducing dependencies between classes.
It eliminates the need for inheritance.