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

Answer : D

Explanation

Singleton pattern is one of the simplest design patterns in Java. This type of design pattern comes under creational pattern as this pattern provides one of the best ways to create an object.This pattern involves a single class which is responsible to create an object while making sure that only single object gets created. This class provides a way to access its only object which can be accessed directly without need to instantiate the object of the class.

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 is used when creation of object directly is costly?

A - Bridge Pattern

B - Adapter Pattern

C - Prototype Pattern

D - Filter Pattern

Answer : A

Explanation

Prototype pattern is used when creation of object directly is costly.

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 is used to get a way to access the elements of a collection object in sequential manner without any need to know its underlying representation?

A - Iterator Pattern

B - Mediator Pattern

C - Memento Pattern

D - Observer Pattern

Answer : A

Explanation

Iterator pattern is used to get a way to access the elements of a collection object in sequential manner without any need to know its underlying representation.

Q 6 - In which of the following pattern, a class behavior or its algorithm can be changed at run time?

A - State Pattern

B - Null Object Pattern

C - Strategy Pattern

D - Template Pattern

Answer : C

Explanation

In Strategy pattern, a class behavior or its algorithm can be changed at run time.

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.

Q 10 - In MVC pattern, Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.

A - true

B - false

Answer : A

Explanation

True. In MVC pattern, Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.

design_pattern_questions_answers.htm
Advertisements