Design Pattern MCQ Questions & Answers
Design Pattern MCQs : This section focuses on "Basics" of Design Pattern. These Multiple Choice Questions (MCQ) should be practiced to improve the Design Pattern skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. ___________ represent the best practices used by experienced object-oriented software developers.
A. EB2
B. IMS
C. Design Patterns
D. JCL
View Answer
Ans : C
Explanation: Design patterns represent the best practices used by experienced object-oriented software developers.
2. GOF stands for ?
A. Gamma of four
B. Gang of four
C. Gang of helm
D. Gamma of helm
View Answer
Ans : B
Explanation: In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled Design Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development. These authors are collectively known as Gang of Four (GOF).
3. Design patterns can be classified in _______ categories.
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : C
Explanation: Design patterns can be classified in three categories: Creational, Structural and Behavioral patterns.
4. Which design patterns are specifically concerned with communication between objects?
A. Creational Patterns
B. Structural Patterns
C. Behavioral Patterns
D. J2EE Patterns
View Answer
Ans : C
Explanation: Behavioral Patterns : These design patterns are specifically concerned with communication between objects.
5. Which pattern are identified by Sun Java Center?
A. Factory pattern
B. Abstract Factory pattern
C. Behavioral Patterns
D. J2EE Patterns
View Answer
Ans : D
Explanation: These design patterns are specifically concerned with the presentation tier. These patterns are identified by Sun Java Center.
6. Factory pattern is one of most used design pattern in Java.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Factory pattern is one of most used design pattern in Java.
7. In how many steps Singleton class in java created?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: It is two step process. First, make the constructor private so that new operator cannot be used to instantiate the class. Return an object of the object if not null otherwise create the object and return the same via a method.
8. _________ works as a bridge between two incompatible interfaces.
A. Prototype pattern
B. Adapter pattern
C. Bridge pattern
D. Filter pattern
View Answer
Ans : B
Explanation: Adapter pattern works as a bridge between two incompatible interfaces. This pattern involves a single class which is responsible to join functionalities of independent or incompatible interfaces.
9. Filter pattern also known as?
A. Adapter pattern
B. Composite pattern
C. Filter pattern
D. Decorator pattern
View Answer
Ans : C
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. This type of design pattern comes under structural pattern as this pattern combines multiple criteria to obtain single criteria.
10. Can we create a clone of a singleton object?
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, we create a clone of a singleton object.
Discussion