Design Patterns Introduction
- 45Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
45 questions
- 1Design patterns are essentially ways of solving_____problems in similar ways.
Hint
Think about the core idea of reusing solutions.
Answer
similar
- 2The benefits of using design patterns include scalability, testability, separation of concerns, standard_____, and best practices.
Hint
This helps developers communicate effectively about their solutions.
Answer
terminology
- 3The_____are the four authors of the foundational book on design patterns.
Hint
They are often referred to as a group of software architects.
Answer
Gang of Four
- 4Creational design patterns relate to how you create specific_____.
Hint
They deal with object creation mechanisms.
Answer
objects
- 5Structural design patterns deal with how to structure the overall_____.
Hint
They focus on class and object composition.
Answer
project
- 6Behavioral design patterns relate to how components_____in the application.
Hint
They describe communication between objects.
Answer
interact
- 7The Singleton pattern provides a single_____for a resource.
Hint
It ensures a class has only one object.
Answer
instance
- 8A disadvantage of the Singleton is that it breaks the_____principle.
Hint
This principle means a class should have only one reason to change.
Answer
single responsibility
- 9In a multi-threaded environment, a naive Singleton implementation can be fixed by using a_____.
Hint
This synchronization mechanism prevents multiple threads from simultaneously creating instances.
Answer
lock
- 10The Factory Method pattern separates the_____of an object from its utilization.
Hint
It decouples the client from the instantiation logic.
Answer
creation
- 11In the Factory Method pattern, the design logic and creation are hidden from the_____.
Hint
The client uses the object without knowing how it was created.
Answer
client
- 12Abstract Factory is one level of abstraction above Factory Method; it is a factory that creates_____.
Hint
Think of it as a meta-factory.
Answer
factories
- 13In the Abstract Factory example, the_____restaurant and American restaurant are concrete factories.
Hint
One of the two types of cuisine mentioned.
Answer
French
- 14The Builder pattern allows an object to be initialized in_____ways.
Hint
It provides flexibility in constructing complex objects.
Answer
different
- 15In Python, a simplified Builder can be implemented using_____parameters in the constructor.
Hint
These allow you to specify only the parameters you need.
Answer
named
- 16The Prototype pattern lets us copy existing objects without depending on their_____.
Hint
It relies on the object itself to provide copying.
Answer
class
- 17In Python, the_____
copymodule provides two functions:copy(shallow copy) and `` (deep copy).Hint
The function name suggests it copies nested objects recursively.
Answer
deepcopy
- 18The Adapter pattern converts one_____of a class into another that the client expects.
Hint
It bridges incompatible interfaces.
Answer
interface
- 19In the Adapter example, the_____
DisplayDataAdapterinherits from bothStoreDatabaseDataand ``.Hint
This is the third-party class being adapted.
Answer
DisplayData
- 20The Bridge pattern converts from_____to composition.
Hint
It replaces class inheritance with object composition.
Answer
inheritance
- 21In the Bridge example, the_____
BasicRemoteholds a reference to aobject.Hint
This is the implementor interface.
Answer
device
- 22The Composite pattern allows you to structure objects into_____and manipulate multiple objects as a single one.
Hint
This structure is hierarchical.
Answer
trees
- 23In the Composite example, the_____
Compositeclass has apriceproperty that returns theof all items.Hint
It aggregates the prices of child components.
Answer
sum
- 24The Decorator pattern attaches new_____to an object without altering existing code.
Hint
It wraps the original object.
Answer
behavior
- 25In the Decorator example, the_____
EnhancedCoffeeMachinewraps a `` object and adds its own functionality.Hint
This is the underlying object being decorated.
Answer
BasicCoffeeMachine
- 26The Facade pattern provides a simple_____to complex functionality.
Hint
It hides the complexity of the underlying system.
Answer
interface
- 27In the Facade example, the_____
UserRepositoryis athat hides theComplexSystemStoredetails.Hint
This class provides a simplified API.
Answer
facade
- 28The Flyweight pattern reduces memory footprint by sharing_____parts among similar objects.
Hint
It separates intrinsic (shared) state from extrinsic (unique) state.
Answer
common
- 29In the Flyweight example, the_____
FighterFactorystores only threeinstances, one for each rank.Hint
These are the shared flyweight objects.
Answer
Fighter
- 30The Proxy pattern provides the same_____as the original object and manages its lifecycle.
Hint
The client cannot distinguish the proxy from the real object.
Answer
interface
- 31In the Proxy example, the_____
ProxyImagecaches the `` and only loads it from disk once.Hint
This is the actual image object behind the proxy.
Answer
RealImage
- 32The Chain of Responsibility pattern defines a chain of_____to process a request.
Hint
Each can either process or pass the request along.
Answer
handlers
- 33In the Chain of Responsibility example, the_____
AuthenticationHeaderadds an authorization header and calls `` to pass the request to the next handler.Hint
This method moves the request down the chain.
Answer
do_next
- 34The Command pattern wraps a request in an_____that contains all required information.
Hint
This allows parameterization of clients with different requests.
Answer
object
- 35In the Command example, the_____
CommandProcessorhas a queue of commands and calls `` on each when processing.Hint
This is the method that performs the command's action.
Answer
execute
- 36The Interpreter pattern recursively evaluates_____and expressions in a language.
Hint
It defines a representation for the language's grammar.
Answer
grammar
- 37In the Interpreter example, terminal expressions represent_____and non-terminal expressions represent operators.
Hint
These are the leaf nodes in the abstract syntax tree.
Answer
numbers
- 38The Iterator pattern provides a way to traverse a_____without exposing its underlying representation.
Hint
It allows sequential access to elements.
Answer
collection
- 39The Mediator pattern provides a central object for_____between objects.
Hint
It reduces dependencies between components.
Answer
communication
- 40The Memento pattern saves and restores previous_____without revealing implementation details.
Hint
It implements undo/redo functionality.
Answer
state
- 41In the Memento pattern, the_____creates the memento, and the caretaker saves and restores them.
Hint
This is the object whose state is being saved.
Answer
originator
- 42The Observer pattern defines a subscription mechanism where objects (observers) are notified when a subject changes_____.
Hint
They are registered to receive updates.
Answer
state
- 43In the Observer example, the_____
EventManagermaintains a list offor each event type.Hint
These are the observers that get notified.
Answer
listeners
- 44The State pattern allows an object to change its behavior based on its internal_____.
Hint
It looks like the object changes its class.
Answer
state
- 45In the State example, the game can be in states: welcome screen, playing, break, and_____.
Hint
This is the final state after the game finishes.
Answer
end game

Ask anything
We've read this whole study set, so questions about it get the best answers.