Creational Design Patterns

Structural Design Patterns

Behavioral Design Patterns

J2EE Design Patterns

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.

Questions and Answers

Q 1 - Can we create a clone of a singleton object?

A - true

B - false

Answer : A

Explanation

true. It is possible to get a clone of singleton object. Throw exception within the body of clone() method to prevent cloning.

Q 3 - Which of the following pattern is used when we need to decouple an abstraction from its implementation so that the two can vary independently?

A - Bridge Pattern

B - Adapter Pattern

C - Prototype Pattern

D - Filter Pattern

Answer : A

Explanation

Bridge pattern is used when we need to decouple an abstraction from its implementation so that the two can vary independently.

Q 4 - Which of the following pattern allows a user to add new functionality to an existing object without altering its structure?

A - Composite Pattern

B - Facade Pattern

C - Flyweight Pattern

D - Decorator Pattern

Answer : D

Explanation

Decorator Pattern allows a user to add new functionality to an existing object without altering its structure.

Q 5 - Which of the following pattern is used to restore state of an object to a previous state?

A - Iterator Pattern

B - Mediator Pattern

C - Memento Pattern

D - Observer Pattern

Answer : C

Explanation

Memento pattern is used to restore state of an object to a previous state.

Q 6 - In which of the following pattern, an abstract class exposes defined way(s)/template(s) to execute its methods?

A - State Pattern

B - Null Object Pattern

C - Strategy Pattern

D - Template Pattern

Answer : D

Explanation

In Template pattern, an abstract class exposes defined way(s)/template(s) to execute its methods.

Q 7 - Which of the following pattern is used in EJB persistence mechanism?

A - Visitor Pattern

B - MVC Pattern

C - Business Delegate Pattern

D - Composite Entity Pattern

Answer : D

Explanation

Composite Entity pattern is used in EJB persistence mechanism.

Q 8 - Which of the following pattern is used when we want to do some pre-processing / post-processing with request or response of the application?

A - DAO Pattern

B - Front Controller Pattern

C - Intercepting Pattern

D - Service Locator Pattern

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 9 - Which type of design patterns concern class and object composition?

A - Creational Design Patterns

B - Structural Design Patterns

C - Behavioral Design Pattern

D - J2EE Design Patterns

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.

Answer : B

Explanation

Service, Context, Service Locator, Cache, Client are the entities of Service Locator pattern.

design_pattern_questions_answers.htm
Advertisements