wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Structural and Behavioral Design Patterns

Total questions: 20

Worksheet time: 16mins

Name
Class
Date
1.

Purpose Defines an abstract object structure independently of the implementation object structure in order to limit coupling.

Use When

Abstractions and implementations should not be bound at compile time.

a)

Adapter

b)

Bridge

2.

Convert the interface of a class into another interface clients expect and let classes work together, that could not otherwise because of incompatible interfaces.

a)

Bridge

b)

Adapter

c)

Composite

d)

Observer

3.

Represents an operation to be performed on the elements of an object structure. This Pattern lets you define a new operation without changing the classes of the elements on which it operates.

a)

Bridge

b)

Mediator

c)

Observer

d)

Visitor

4.

Permits classes with disparate interfaces to work together by creating a common object by which they may communicate and interact.

Use When

A class to be used doesn’t meet interface requirements.

a)

Adapter

b)

Bridge

5.

Compose objects into tree structures to represent part-whole hierarchies. / Composite lets clients treat individual objects and compositions of objects uniformly.

a)

Bridge

b)

Adapter

c)

Composite

d)

Observer

6.

Purpose Defines an abstract object structure independently of the implementation object structure in order to limit coupling.

Use When

Abstractions and implementations should be independently extensible.

a)

Adapter

b)

Bridge

7.

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

a)

Strategy

b)

Mediator

c)

Observer

d)

Adapter

8.

A billing application needs to interface with an HR application in order to exchange employee data, however each has its own interface and implementation for the Employee object. In addition, the SSN is stored in different formats by each system.

What pattern can we use to create a common interface between the two applications that allows them to communicate using their native objects and is able to transform the SSN format in the process?

a)

Adapter

b)

Bridge

c)

Chain of Responsibility

d)

Observer

9.

Permits classes with disparate interfaces to work together by creating a common object by which they may communicate and interact.

Use When

Complex conditions tie object behavior to its state.

a)

Adapter

b)

Bridge

10.

It decouples an abstraction from its implementation so that the two can vary independently.

Is it about Bridge Pattern?

a)

True

b)

False

11.

Purpose Defines an abstract object structure independently of the implementation object structure in order to limit coupling.

Use When

Changes in the implementation of an abstraction should have no impact on clients.

a)

Adapter

b)

Bridge

12.

Allows objects with incompatible interfaces to work together.

Is it about Adapter Pattern?

a)

True

b)

False

13.

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

a)

Bridge

b)

Mediator

c)

Observer

d)

Adapter

14.

Permits classes with disparate interfaces to work together by creating a common object by which they may communicate and interact.

Use When

Transitions between states need to be explicit.

a)

Adapter

b)

Bridge

15.

• When you want to use a class that's interface isn't compatible with your code.

• When you want to use subclasses that lack common functionality and can't be added to the superclass.

Use ________________ Pattern

a)

Adapter

b)

Bridge

c)

Chain of Responsibility

d)

Command

16.

Purpose Defines an abstract object structure independently of the implementation object structure in order to limit coupling.

Use When

Implementation details should be hidden from the client

a)

Adapter

b)

Bridge

17.

Define an object that encapsulates how a set of objects interact. This Pattern promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.

a)

Bridge

b)

Mediator

c)

Composite

d)

Adapter

18.

The implementation of the Adapter Pattern decreases the complexity of the code because you need not introduce new interfaces.

a)

True

b)

False

19.

It avoids attaching the sender of a request to its receiver, giving this way other objects the possibility of handling the request too.

a)

Bridge

b)

Adapter

c)

Composite

d)

Chain of Responsibility

20.

Encapsulate a request in an object, Allows the parameterization of clients with different requests and Allows saving the requests in a queue.

a)

Bridge

b)

Command

c)

Composite

d)

Adapter