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 2 - Event handling frameworks like swing, awt use Observer Pattern.

A - false

B - true

Answer : B

Explanation

true. Event handling frameworks like swing, awt use Observer Pattern.

Q 3 - Which of the following pattern refers to creating duplicate object while keeping performance in mind?

A - Builder Pattern

B - Bridge Pattern

C - Prototype Pattern

D - Filter Pattern

Answer : C

Explanation

Prototype pattern refers to creating duplicate object while keeping performance in mind.

Q 4 - In which of the following pattern a class represents functionality of another class?

A - Proxy Pattern

B - Chain of Responsibility Pattern

C - Command Pattern

D - Interpreter Pattern

Answer : A

Explanation

In proxy pattern, a class represents functionality of another class. In proxy pattern, we create object having original object to interface its functionality to outer world.

Q 5 - Which of the following pattern a request is wrapped under an object as command and passed to invoker object?

A - Proxy Pattern

B - Chain of Responsibility Pattern

C - Command Pattern

D - Interpreter Pattern

Answer : C

Explanation

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 6 - In which of the following pattern, a null object replaces check of NULL object instance?

A - State Pattern

B - Null Object Pattern

C - Strategy Pattern

D - Template Pattern

Answer : B

Explanation

In Null Object pattern, a null object replaces check of NULL object instance.

Q 8 - Which of the following pattern is used when we want to locate various services using JNDI lookup?

A - DAO Pattern

B - Front Controller Pattern

C - Intercepting Pattern

D - Service Locator Pattern

Answer : D

Explanation

Service Locator Pattern is used when we want to locate various services using JNDI lookup.

Answer : C

Explanation

Filter, Filter Chain, Target, Filter Manager, Client are the entities of Intercepting pattern.

design_pattern_questions_answers.htm
Advertisements