0% found this document useful (0 votes)
1K views5 pages

Quiz 1 Design Pattern

This document contains 30 multiple choice questions related to design patterns. The questions cover topics like the different types of design patterns (creational, structural, behavioral), when and how to apply specific patterns like factory, prototype, facade, decorator, builder patterns, and basic object oriented programming concepts like encapsulation, inheritance, polymorphism. The last question specifies that "Java patterns" is not a valid classification of design patterns.

Uploaded by

Genghis Khan 69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views5 pages

Quiz 1 Design Pattern

This document contains 30 multiple choice questions related to design patterns. The questions cover topics like the different types of design patterns (creational, structural, behavioral), when and how to apply specific patterns like factory, prototype, facade, decorator, builder patterns, and basic object oriented programming concepts like encapsulation, inheritance, polymorphism. The last question specifies that "Java patterns" is not a valid classification of design patterns.

Uploaded by

Genghis Khan 69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1:- Which one is not an element of pattern.

a. Pattern name.
b. Suggestions
c. Problem
d. Solution

2:- Problem will include a list of conditions that must be meet _____ it makes sense to apply the pattern.

a. After
b. At the end of
c. Before
d. None

3:- Class represents a set of objects having similar _______.

a. Associations
b. Relationships
c. Responsibilities
d. All of given

4:- An object named as “House” has some states such as:

a. Open door and close door


b. Address, color and area
c. Both a and b
d. None of these

5:- We can create a fully encapsulated class in Java by making all the data members of the class ______.

a. Public
b. Protected
c. Private
d. Partnership

6:- The mechanism by which an object acquires the properties of another object is called.

a. Encapsulation
b. Abstraction
c. Inheritance
d. Polymorphism

7:- which statement is not true about polymorphism?

a. In polymorphism an object acquires the properties of another object.


b. Polymorphism has two types.
c. Polymorphism refers to existence of different forms of a single entity.
d. Both b and c
8:- Consider two classes Student class and Address class. Every student has an address so the
relationship between student and address is a Has-A relationship. But if you consider it’s vice versa then
it would not make any sense as an Address doesn’t need to have a Student necessarily.

a. True
b. False
c. Probably
d. Probably not

9:- Characteristics of a good software are.

a. Low coupling and low cohesion.


b. Low coupling and high cohesion.
c. High coupling and high cohesion.
d. None

10:- The pattern's _______ conveys the essence of the pattern succinctly.

a. Intent
b. Motivation
c. Name
d. Name and motivation

11:- ______ is/are the structural design pattern.

a. Adapter
b. Bridge
c. Composite
d. All of above

12:- We classify design patterns by two criteria:

a. Polymorphism and aggregation


b. Scope and purpose
c. Behavior and structure
d. Object and class

13:- When classes delegate responsibility to one of several helper subclasses, and you want to localize
the knowledge of which helper subclass is the delegate we use.

a. Interpreter method
b. Template method
c. Factory method
d. Adapter method

14:- What will you use when you want to provide a class library of products, and you want to reveal just
their interfaces, not their implementation.

a. Template pattern
b. Factory pattern
c. Adapter pattern
d. Abstract factory pattern

15:- Which statement is true about factory design pattern.

a. Factory design pattern provides approach to code for interface rather than implementation.
b. Factory pattern removes the instantiation of actual implementation classes from client code.
c. Factory pattern provides abstraction between implementation and client classes through
inheritance.
d. All of above

16:- Adapter design pattern also known as.

a. Wrapper
b. Kit
c. Virtual constructor
d. Abstraction

17:- Sometimes a class that's designed for reuse isn't reusable only because its interface doesn't match

a. The scenario that illustrate the design.


b. Rationale and intent.
c. The domain specific interface an application requires.
d. All of these.

18:- American socket and plug are different from British. Their interface are not compatible with one
another. British plugs are cylindrical and American plugs are rectangular. You can use an _______ in
between to fit an American (rectangular) plug in British (cylindrical) socket assuming voltage
requirements are met with.

a. A&C
b. Adapter
c. Electric plug
d. Power bank

19:- Facade design pattern defines a __________ interface that make a subsystem easier to use.

a. High level
b. Low level
c. Simple
d. Both a and c

20:- First step of implementation of a façade design pattern is:

a. Creating façade class


b. Creating concrete class
c. Creating an interface
d. Using the façade to draw various types of shapes
21:- You want to know about the menus of different restaurants in a hotel, you only have access to the
hotel keeper who knows everything of hotel then you ask the hotel keeper to get the menus whichever
you want. He takes it out from respective restaurant and hides the complexities of the hotel system.

The hotel keeper acts like?

a. Adapter
b. Bridge
c. Prototype
d. Façade

22:- When you want to transparently and dynamically add responsibilities on an object without affecting
other objects you use?

a. Decorator design pattern


b. Façade design pattern
c. Prototype design pattern
d. Composite design pattern

23:- Ice-cream is a classic example of?

a. Façade design pattern


b. Decorator design pattern
c. Prototype design pattern
d. Composite design pattern

24:- Other than decorator pattern there is a way to add responsibilities on an object through.

a. Inheritance
b. Encapsulation
c. Abstraction
d. Polymorphism

25:- The better approach would be to clone an existing object into a new object and then do the:

a. Data implementation
b. Data mining
c. Data manipulation
d. Data extraction

26:- Which statement is not true about prototype design pattern?

a. It reduce the need of subclass.


b. It hides complexities of creating object.
c. It let you add or remove objects at runtime.
d. None
27:- The major issue with factory and abstract factory design pattern when the object contain a lot of
attributes is:

a. Too many arguments


b. Optional parameters
c. Object creational complexity
d. All of above

28:- Real life example of builder design pattern is:-

a. Ice-cream
b. Home
c. Charger
d. Internet

29:- Intent of builder design pattern is to.

a. Separate the construction of a complex object from its representation.


b. Define an interface for creating an object.
c. Provide an interface for creating families of related objects.
d. Convert the interface of a class into another interface clients expect.

30:- Which of the below is not a valid classification of design pattern?

a) Creational patterns

b) Structural patterns

c) Behavioral patterns

d) Java patterns

You might also like