Creational Design Patterns
- Design Patterns - Factory Pattern
- Abstract Factory Pattern
- Design Patterns - Singleton Pattern
- Design Patterns - Builder Pattern
- Design Patterns - Prototype Pattern
Structural Design Patterns
- 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
Behavioral Design Patterns
- 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 - Strategy Pattern
- Design Patterns - Template Pattern
- Design Patterns - Visitor Pattern
J2EE Design Patterns
- Design Patterns - Null Object 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 Useful Resources
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 Factory design pattern.
A - This type of design pattern comes under creational pattern.
B - Factory pattern creates object without exposing the creation logic to the client.
C - Factory pattern refers to newly created object using a common interface.
Answer : D
Explanation
Factory pattern is one of most used design pattern in Java. This type of design pattern comes under creational pattern as this pattern provides one of the best ways to create an object. In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface.
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 describes the Decorator pattern correctly?
Answer : A
Explanation
Decorator pattern allows a user to add new functionality to an existing object without altering its structure.
Q 4 - Which of the following describes the Proxy 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 : A
Explanation
In proxy pattern, a class represents functionality of another class. This type of design pattern comes under structural pattern. In proxy pattern, we create object having original object to interface its functionality to outer world.
Q 5 - Which of the following describes the Observer pattern correctly?
B - This pattern is used to reduce communication complexity between multiple objects or classes.
C - This pattern is used to restore state of an object to a previous state.
Answer : D
Explanation
This pattern is used when there is one-to-many relationship between objects such as if one object is modified, its depenedent objects are to be notified automatically.
Q 6 - Which of the following describes the Visitor pattern correctly?
B - This pattern is used to separate application's concerns.
C - This pattern is used to decouple presentation tier and business tier.
Answer : A
Explanation
In Visitor pattern, a visitor class is used which changes the executing algorithm of an element class.
Q 7 - Which of the following pattern is used to separate low level data accessing API or operations from high level business services?
Answer : A
Explanation
DAO Pattern is used to separate low level data accessing API or operations from high level business services.
Q 8 - Which of the following pattern creates object without exposing the creation logic to the client and refer to newly created object using a common interface?
Answer : A
Explanation
Factory Pattern creates object without exposing the creation logic to the client and refer to newly created object using a common interface.
Q 9 - Which of the following describes the Structural pattern correctly?
C - This type of pattern are specifically concerned with communication between objects.
D - This type of pattern are specifically concerned with the presentation tier.
Answer : B
Explanation
Structural Design Patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
Q 10 - Which of the following is the correct list of entities of DAO pattern?
A - Data Access Object Interface, Data Access Object concrete class, Model Object or Value Object
B - Data Access Object Interface, Model Object or Value Object
C - Data Access Object Interface, Data Access Object concrete class
D - Data Access Object concrete class, Model Object or Value Object
Answer : A
Explanation
Data Access Object Interface, Data Access Object concrete class, Model Object or Value Object are the entities of DAO Pattern.