In Python, a common way to implement a Singleton is by using:
Multiple inheritance
Abstract classes
Decorators
Interfaces
How does the Strategy Pattern promote the Open/Closed Principle?
It prevents modification of existing strategies, ensuring their integrity.
It allows adding new strategies without modifying the existing Context class.
It reduces the need for inheritance, making the codebase more flexible.
It promotes code reuse by allowing strategies to be shared across multiple contexts.
In the context of the Strategy Pattern, what does a 'Context' object typically do?
It implements the actual algorithms defined by the Strategy interface.
It maintains a reference to a Strategy object and delegates work to it.
It acts as a factory for creating Strategy objects.
It defines the interface for all Concrete Strategies.
How does the Singleton pattern typically provide access to its single instance?
Through a static method within the class.
Through a public constructor.
By directly accessing a public instance variable.
Using a separate factory class.
In the context of the Factory Method pattern, what does the 'factory method' typically return?
An instance of a specific concrete class.
A configuration object used to customize object creation.
An abstract interface or base class type.
A primitive data type, such as an integer or a string.
What is a key characteristic of a well-implemented design pattern?
It is tightly coupled to a specific problem domain.
It introduces significant code complexity.
It eliminates the need for documentation.
It promotes code reusability and maintainability.
Which principle of object-oriented design does the Adapter Pattern primarily promote?
Encapsulation
Inheritance
Polymorphism
Composition
How does the Command Pattern achieve decoupling?
By using inheritance to create specialized request handlers.
By relying on a central registry to map requests to their handlers.
By introducing an intermediary object (the Command) between the invoker and the receiver.
By directly connecting the object making the request with the object fulfilling it.
In a Singleton class, the constructor is typically declared as:
public
protected
private
static
What is the primary intent of the Facade Pattern in software design?
To provide a simplified interface to a complex subsystem.
To expose low-level implementation details to clients.
To create new functionalities within existing classes.
To define a family of algorithms and encapsulate each one.