Design Patterns Overview
- 59Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
59 questions
- 1Design patterns are well-tested, reusable solutions that are also_____solutions.
Hint
They have been optimized through many uses.
Answer
optimal
- 2Design patterns provide a common_____for developers to facilitate communication.
Hint
They help architects be on the same page.
Answer
vocabulary
- 3The three families of design patterns covered in this course are creational, structural, and_____.
Hint
This family deals with interaction and communication between objects.
Answer
behavioral
- 4Creational design patterns manage_____creation mechanisms.
Hint
They deal with how objects are instantiated.
Answer
object
- 5Structural design patterns improve and simplify designs by identifying efficient ways of composing_____among entities.
Hint
They focus on object composition and hierarchies.
Answer
relationships
- 6Behavioral design patterns improve_____and communication between objects.
Hint
They deal with how objects exchange messages.
Answer
interaction
- 7The Singleton pattern ensures a class has only one_____and provides global access to it.
Hint
It controls instantiation to a single object.
Answer
instance
- 8The Singleton pattern is an example of_____instantiation if the instance is created only when first needed.
Hint
Creation is deferred until the first request.
Answer
lazy
- 9The_____pattern provides a mechanism for creating objects without exposing the instantiation logic to the client.
Hint
It uses a method to create objects instead of constructors.
Answer
Factory Method
- 10In the Factory Method pattern, objects are created through an_____not a concretion.
Hint
The caller uses a common interface rather than concrete types.
Answer
abstraction
- 11The Builder pattern separates the construction of a complex object from its_____.
Hint
The construction process can create different representations.
Answer
representation
- 12In the Builder pattern, the_____coordinates the construction steps by delegating to a builder.
Hint
It manages the building process.
Answer
director
- 13The Adapter pattern converts the_____of a class into another interface that clients expect.
Hint
It makes incompatible interfaces work together.
Answer
interface
- 14The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them_____.
Hint
They can be swapped at runtime.
Answer
interchangeable
- 15In the Strategy pattern, the_____class aggregates a strategy interface.
Hint
It is the class that uses the strategy.
Answer
context
- 16The Observer pattern creates a one-to-many dependency so that when one object changes state, all its_____are notified.
Hint
They subscribe to updates.
Answer
dependents
- 17The State pattern allows an object to alter its behavior when its internal_____changes.
Hint
The object appears to change its class.
Answer
state
- 18In UML, class diagrams convey the_____of a design pattern.
Hint
They show classes and relationships.
Answer
structure
- 19Sequence diagrams illustrate the_____of objects over time.
Hint
They show method calls in order.
Answer
interaction
- 20A generalization relationship in UML represents_____.
Hint
It is an 'is-a' relationship.
Answer
inheritance
- 21An aggregation with a black diamond indicates that the whole_____its part.
Hint
The part cannot exist without the whole.
Answer
contains
- 22Loose coupling means weak knowledge_____between components.
Hint
Changes to one component affect few others.
Answer
association
- 23Separation of concerns breaks architecture into main tiers such as presentation, business, and_____.
Hint
It's also called resource access layer.
Answer
data access
- 24The Law of Demeter states that a unit should only talk to its_____.
Hint
It should not talk to strangers.
Answer
friends
- 25The Single Responsibility Principle states that there should never be more than one_____for a class to change.
Hint
Each class should have one central responsibility.
Answer
reason
- 26The Open-Closed Principle states that software entities should be open for extension but closed for_____.
Hint
You can add new behavior without changing existing code.
Answer
modification
- 27The Liskov Substitution Principle says that functions using base classes must be able to use objects of_____classes without knowing it.
Hint
Subtypes must be substitutable for their base types.
Answer
derived
- 28The Interface Segregation Principle states that clients should not be forced to depend upon_____they do not use.
Hint
Avoid fat interfaces.
Answer
interfaces
- 29The Dependency Inversion Principle states that one should depend upon_____not concretions.
Hint
High-level modules should not depend on low-level modules.
Answer
abstractions
- 30In Python, a class is a_____for creating objects.
Hint
It defines attributes and methods.
Answer
recipe
- 31The `_____` method is the constructor in Python, responsible for initializing an object's attributes.
Hint
It is called automatically after object creation.
Answer
init
- 32Encapsulation in OOP means gathering relevant data and_____in one place.
Hint
It controls complexity and hides internal details.
Answer
functionality
- 33Inheritance allows a class to generalize by inheriting_____and behavior from a parent class.
Hint
It promotes code reuse.
Answer
data
- 34In Python, an abstract class is created by inheriting from `_____`.
Hint
It stands for Abstract Base Class.
Answer
ABC
- 35An interface in Python is an abstract class with only abstract methods and_____implementation.
Hint
It defines a contract without providing functionality.
Answer
no
- 36A metaclass in Python is a class that defines the behavior for creating_____.
Hint
It is a 'class of a class'.
Answer
classes
- 37The Singleton pattern can be implemented in Python using a_____class, which controls instantiation.
Hint
It overrides the
__call__method.Answer
metaclass
- 38Thread safety in Singleton is achieved by using a_____to protect the critical section.
Hint
It serializes access to the instance creation.
Answer
lock
- 39In the classic Gang of Four Singleton, the constructor is made private or disabled by overriding `_____` to throw an error.
Hint
It prevents external instantiation.
Answer
init
- 40The Factory Method pattern has two variants: the classic and the simple (parameterized) Factory method. The simple factory uses a_____method to create instances.
Hint
It is often implemented as a static method.
Answer
static
- 41In the Builder pattern, the concrete builder implements the building steps defined in the_____builder interface.
Hint
It provides concrete implementations for each step.
Answer
abstract
- 42The Adapter pattern can be used to convert data formats, such as from_____to JSON.
Hint
Example in course: investment data from XML to JSON.
Answer
XML
- 43The Strategy pattern is often used to avoid_____statements that switch between different variants of an algorithm.
Hint
It replaces complex conditionals with polymorphic objects.
Answer
conditional
- 44In the Observer pattern, the subject maintains a list of observers and notifies them of state changes by calling their_____method.
Hint
This method is defined in the observer interface.
Answer
update
- 45The State pattern is similar to the concept of_____machines.
Hint
It involves a finite number of states with discrete transitions.
Answer
finite state
- 46In Python, an abstract method is declared using the `_____` decorator.
Hint
It forces subclasses to implement the method.
Answer
@abstractmethod
- 47The `_____` method in a metaclass is responsible for controlling the creation of instances of the classes it creates.
Hint
It is invoked when a class instance is called.
Answer
call
- 48In the course, John Conway's Game of Life is used as a project to apply design patterns. The game is a_____player game.
Hint
Its evolution is determined solely by the initial state.
Answer
zero
- 49In the Game of Life, a live cell with two or three live neighbors_____.
Hint
It remains alive in the next generation.
Answer
survives
- 50A dead cell with exactly three live neighbors becomes a_____cell.
Hint
This represents birth.
Answer
live
- 51All other live cells (with fewer than 2 or more than 3 live neighbors)_____in the next generation.
Hint
They die from underpopulation or overpopulation.
Answer
die
- 52UML diagrams used in the course are class diagrams and_____diagrams.
Hint
They show interactions over time.
Answer
sequence
- 53In UML, a dependency is shown as a dashed arrow and indicates that one class_____another.
Hint
It is a weaker relationship than association.
Answer
uses
- 54In the context of the Adapter pattern, the_____is the existing class that needs to be adapted.
Hint
It has an incompatible interface.
Answer
adaptee
- 55The_____pattern is described as the 'crowning jewel' of Gang of Four design patterns.
Hint
It allows algorithms to vary independently.
Answer
Strategy
- 56The Observer pattern is key to reactive behavior and is a core part of the_____architectural pattern.
Hint
It's used in many UI frameworks.
Answer
MVC
- 57In the State pattern, each concrete state is often implemented as a_____because it has no internal state of its own.
Hint
They are shared across contexts.
Answer
Singleton
- 58The_____principle in SOLID states that you should depend on abstractions, not concretions.
Hint
The 'D' in SOLID.
Answer
Dependency Inversion
- 59The_____pattern provides the exact same interface to the wrapped object (as opposed to Adapter which changes the interface).
Hint
It controls access without changing the interface.
Answer
Proxy

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