Recall & Review
beginner
What is the main purpose of the Singleton pattern?
The Singleton pattern ensures a class has only one instance and provides a global point of access to it.Click to reveal answer
beginner
When should you use the Factory Method pattern?
Use Factory Method when you want to create objects without specifying the exact class, allowing subclasses to decide which class to instantiate.Click to reveal answer
intermediate
What problem does the Abstract Factory pattern solve?
Abstract Factory provides an interface to create families of related or dependent objects without specifying their concrete classes.
Click to reveal answer
intermediate
When is the Builder pattern most useful?
Builder is useful when constructing complex objects step-by-step, especially when the object has many optional parts or configurations.
Click to reveal answer
intermediate
Why use the Prototype pattern?
Prototype is used to create new objects by copying existing ones, which is helpful when object creation is costly or complex.
Click to reveal answer
Which creational pattern ensures only one instance of a class exists?
✗ Incorrect
Singleton pattern restricts instantiation of a class to one object.
Which pattern is best when you need to create families of related objects without specifying their concrete classes?
✗ Incorrect
Abstract Factory provides interfaces for creating related objects without specifying their concrete classes.
When should you use the Builder pattern?
✗ Incorrect
Builder pattern helps build complex objects step-by-step, especially with many optional parts.
Which pattern allows subclasses to decide which class to instantiate?
✗ Incorrect
Factory Method lets subclasses choose the class to instantiate.
What is a key benefit of the Prototype pattern?
✗ Incorrect
Prototype creates new objects by copying existing ones, saving creation cost.
Explain when to use the Singleton, Factory Method, and Builder patterns in simple terms.
Think about controlling instance count, choosing object types, and building complex objects.
You got /3 concepts.
Describe the difference between Abstract Factory and Prototype patterns and when each is appropriate.
Focus on object families vs cloning.
You got /3 concepts.