- 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 Mock Test
This section presents you various set of Mock Tests related to Design Patterns Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Design Patterns Mock Test III
Q 1 - Which of the following describes the Null Object 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 : B
Explanation
In Null Object pattern, a null object replaces check of NULL object instance.
Q 2 - Which of the following describes the Strategy 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 : C
Explanation
In Strategy pattern, a class behavior or its algorithm can be changed at run time.
Q 3 - Which of the following describes the Template 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 : D
Explanation
In Template pattern, an abstract class exposes defined way(s)/template(s) to execute its methods.
Q 4 - 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 5 - In which of the following pattern, a null object replaces check of NULL object instance?
Answer : B
Explanation
In Null Object pattern, a null object replaces check of NULL object instance.
Q 6 - In which of the following pattern, a class behavior or its algorithm can be changed at run time?
Answer : C
Explanation
In Strategy pattern, a class behavior or its algorithm can be changed at run time.
Q 7 - In which of the following pattern, an abstract class exposes defined way(s)/template(s) to execute its methods?
Answer : D
Explanation
In Template pattern, an abstract class exposes defined way(s)/template(s) to execute its methods.
Q 8 - 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 9 - Which of the following describes the MVC 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 : B
Explanation
MVC pattern is used to separate application's concerns.
Q 10 - Which of the following describes the Business Delegate 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 : C
Explanation
Business Delegate pattern is used to decouple presentation tier and business tier.
Q 11 - Which of the following describes the Composite Entity 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 : D
Explanation
Composite Entity pattern is used in EJB persistence mechanism.
Q 12 - In which of the following pattern, a visitor class is used which changes the executing algorithm of an element class?
Answer : A
Explanation
In Visitor pattern, a visitor class is used which changes the executing algorithm of an element class.
Q 13 - Which of the following pattern is used to separate application's concerns?
Answer : B
Explanation
MVC pattern is used to separate application's concerns.
Q 14 - Which of the following pattern is used to to decouple presentation tier and business tier?
Answer : C
Explanation
Business Delegate pattern is used to decouple presentation tier and business tier.
Q 15 - Which of the following pattern is used in EJB persistence mechanism?
Answer : D
Explanation
Composite Entity pattern is used in EJB persistence mechanism.
Q 16 - Which of the following describes the DAO pattern correctly?
D - This pattern is used when we want to locate various services using JNDI lookup.
Answer : A
Explanation
DAO pattern, is used to separate low level data accessing API or operations from high level business services.
Q 17 - Which of the following describes the Front Controller pattern correctly?
D - This pattern is used when we want to locate various services using JNDI lookup.
Answer : B
Explanation
Front Controller pattern, is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler.
Q 18 - Which of the following describes the Intercepting pattern correctly?
D - This pattern is used when we want to locate various services using JNDI lookup.
Answer : C
Explanation
Intercepting pattern, is used when we want to do some pre-processing / post-processing with request or response of the application.
Q 19 - 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 20 - 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 21 - Which of the following pattern is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler?
Answer : B
Explanation
Front Controller Pattern is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler.
Q 22 - Which of the following pattern is used when we want to do some pre-processing / post-processing with request or response of the application?
Answer : C
Explanation
Intercepting Pattern is used when we want to do some pre-processing / post-processing with request or response of the application.
Q 23 - Which of the following 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 24 - Which of the following describes the Factory pattern correctly?
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 25 - Which of the following describes the Abstract Factory pattern correctly?
Answer : B
Explanation
In Abstract Factory pattern, an interface is responsible for creating a factory of related objects without explicitly specifying their classes.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | C |
3 | D |
4 | A |
5 | B |
6 | C |
7 | D |
8 | A |
9 | B |
10 | C |
11 | D |
12 | A |
13 | B |
14 | C |
15 | D |
16 | A |
17 | B |
18 | C |
19 | D |
20 | A |
21 | B |
22 | C |
23 | D |
24 | A |
25 | B |