Software Design Patterns MCQ Test: Software Design Patterns MCQs - Practice Questions
1. Which design pattern is used for creating objects without specifying the class?
2. What is the Singleton design pattern used for?
3. What is the primary purpose of the Template Method design pattern?
4. When would you use the Prototype design pattern?
5. In which category does the Observer design pattern fall?
6. What is the Open/Closed Principle, as related to design patterns?
7. Elaborate on the concept of the Flyweight design pattern and how it can optimize resource usage in a large-scale application.
8. In the Composite design pattern, what is its primary purpose?
9. Which design pattern is used for creating an interface in a system but letting subclasses alter its behavior?
10. Illustrate the use of the State pattern in modeling a workflow or behavior that can transition between different states. Provide a practical example.
11. Which design pattern is used to define an interface for creating families of related or dependent objects without specifying their concrete classes?
12. In the Decorator design pattern, what is its primary purpose?
13. Compare and contrast the Factory Method and Abstract Factory design patterns. In which scenarios would you prefer one over the other?
14. What problem does the Visitor design pattern solve?
15. When is the Chain of Responsibility design pattern useful?
16. Which design pattern promotes loose coupling between objects by allowing a subject to notify its observers without making assumptions about their identities?
17. Examine the application of the Memento pattern in capturing and restoring an object's internal state. Provide a practical example.
18. When is the Strategy design pattern useful?
19. Illustrate how the Decorator pattern can be used to extend the functionalities of an object, providing a code example.
20. Examine the circumstances where the Chain of Responsibility pattern is valuable, and provide a scenario where it could be effectively applied.