- Design Patterns Tutorial
- Design Patterns - Home
- Design Patterns - Overview
- Design Patterns - Factory Pattern
- Abstract Factory Pattern
- Design Patterns - Singleton Pattern
- Design Patterns - Builder Pattern
- Design Patterns - Prototype Pattern
- Design Patterns - Adapter Pattern
- Design Patterns - Bridge Pattern
- Design Patterns - Filter Pattern
- Design Patterns - Composite Pattern
- Design Patterns - Decorator Pattern
- Design Patterns - Facade Pattern
- Design Patterns - Flyweight Pattern
- Design Patterns - Proxy Pattern
- Chain of Responsibility Pattern
- Design Patterns - Command Pattern
- Design Patterns - Interpreter Pattern
- Design Patterns - Iterator Pattern
- Design Patterns - Mediator Pattern
- Design Patterns - Memento Pattern
- Design Patterns - Observer Pattern
- Design Patterns - State Pattern
- Design Patterns - Null Object Pattern
- Design Patterns - Strategy Pattern
- Design Patterns - Template Pattern
- Design Patterns - Visitor Pattern
- Design Patterns - MVC Pattern
- Business Delegate Pattern
- Composite Entity Pattern
- Data Access Object Pattern
- Front Controller Pattern
- Intercepting Filter Pattern
- Service Locator Pattern
- Transfer Object Pattern
Design Patterns Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Design Patterns Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is correct about Creational design patterns.
A - These design patterns are specifically concerned with communication between objects.
Answer : B
Explanation
Creational design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator.
Q 2 - Which of the following describes the Filter pattern correctly?
A - This pattern builds a complex object using simple objects and using a step by step approach.
B - This pattern refers to creating duplicate object while keeping performance in mind.
Answer : B
Explanation
Filter pattern or Criteria pattern is a design pattern that enables developers to filter a set of objects using different criteria and chaining them in a decoupled way through logical operations.
Q 3 - Which of the following pattern works as a bridge between two incompatible interfaces?
Answer : B
Explanation
Adapter pattern works as a bridge between two incompatible interfaces. This pattern involves a single class which is responsible to join functionalities of independent or incompatible interfaces.
Q 4 - Which of the following describes the Command pattern correctly?
A - In this pattern a class represents functionality of another class.
B - This pattern creates a chain of receiver objects for a request.
C - This pattern provides a way to evaluate language grammar or expression.
D - In this pattern a request is wrapped under an object as command and passed to invoker object.
Answer : D
Explanation
Command pattern is a data driven design pattern and falls under behavioral pattern category. A request is wrapped under an object as command and passed to invoker object. Invoker object looks for the appropriate object which can handle this command and passes the command to the corresponding object which executes the command.
Q 5 - Which of the following describes the State pattern correctly?
A - In this pattern, a class behavior changes based on its state.
B - In this pattern, a null object replaces check of NULL object instance.
C - In this pattern, a class behavior or its algorithm can be changed at run time.
D - In this pattern, an abstract class exposes defined way(s)/template(s) to execute its methods.
Answer : A
Explanation
In State pattern, a class behavior changes based on its state.
Q 6 - In which of the following pattern, a class behavior changes based on its state?
Answer : A
Explanation
In State pattern, a class behavior changes based on its state.
Q 7 - Which of the following describes the Service Locator pattern correctly?
D - This pattern is used when we want to locate various services using JNDI lookup.
Answer : D
Explanation
Service Locator pattern, is used when we want to locate various services using JNDI lookup.
Q 8 - Which of the following pattern involves a single class which is responsible to create an object while making sure that only single object gets created?
Answer : C
Explanation
Singleton Pattern involves a single class which is responsible to create an object while making sure that only single object gets created.
Q 9 - Which of the following pattern is used when we want to pass data with multiple attributes in one shot from client to server?
Answer : D
Explanation
Transfer Object Pattern is used when we want to pass data with multiple attributes in one shot from client to server.
Q 10 - Which of the following is the correct list of entities of Front Controller pattern?
A - Front Controller, Dispatcher, View
B - Front Controller, Dispatcher
Answer : A
Explanation
Front Controller, Dispatcher, View are the entities of Front Controller pattern.