NEW
Font size
S
M
L
XL
WorksheetsBE1 - Structural Design Pattern
Total questions: 20
Worksheet time: 10mins
Name
Class
Date
1.
What is the main purpose of the Adapter design pattern?
a)
To provide a simplified interface for complex subsystems
b)
To allow objects with incompatible interfaces to collaborate
c)
To decouple abstraction from implementation
d)
To efficiently share objects across multiple contexts
2.
Which design pattern is used to separate the abstraction and implementation into two separate class hierarchies?
a)
Adapter
b)
Bridge
c)
Composite
d)
Decorator
3.
In the Bridge design pattern, the abstraction and implementation are connected using:
a)
Inheritance
b)
Composition
c)
Aggregation
d)
Encapsulation
4.
Which design pattern is used to represent part-whole hierarchies?
a)
Adapter
b)
Bridge
c)
Composite
d)
Decorator
5.
What is the main purpose of the Decorator design pattern?
a)
To provide a simplified interface for complex subsystems
b)
To allow objects with incompatible interfaces to collaborate
c)
To separate the abstraction and implementation into two separate class hierarchies
d)
To add behavior dynamically to an object
6.
In the Facade design pattern, the facade class acts as a?
a)
Proxy
b)
Decorator
c)
Adapter
d)
Simplified interface to a complex subsystem
7.
Which design pattern is used to minimize memory usage by sharing common state between multiple objects?
a)
Adapter
b)
Bridge
c)
Composite
d)
Flyweight
8.
The Flyweight design pattern is often used in scenarios where?
a)
Objects with incompatible interfaces need to collaborate
b)
Abstraction and implementation need to be separated
c)
Large numbers of similar objects need to be created
d)
Part-whole hierarchies need to be represented
9.
What is the main purpose of the Proxy design pattern?
a)
To provide a simplified interface for complex subsystems
b)
To allow objects with incompatible interfaces to collaborate
c)
To represent part-whole hierarchies
d)
To control access to an object
10.
In the Adapter design pattern, the adapter class ?
a)
Acts as a simplified interface to a complex subsystem
b)
Adds behavior dynamically to an object
c)
Connects two incompatible interfaces
d)
Represents part-whole hierarchies
11.
Which design pattern is used to convert the interface of a class into another interface clients expect
a)
Adapter
b)
Bridge
c)
Composite
d)
Decorator
12.
In the Bridge design pattern, the abstraction refers to
a)
The higher-level layer of functionality
b)
The lower-level layer of functionality
c)
The interface that defines the abstraction's methods
d)
The implementation that provides the lower-level functionality
13.
What is the main purpose of the Composite design pattern?
a)
To provide a simplified interface for complex subsystems
b)
To allow objects with incompatible interfaces to collaborate
c)
To represent part-whole hierarchies
d)
To dynamically add behavior to an object
14.
The Decorator design pattern follows the principle of ?
a)
Single Responsibility Principle
b)
Open/Closed Principle
c)
Liskov Substitution Principle
d)
Interface Segregation Principle
15.
In the Facade design pattern, the facade class should:
a)
Have a complex interface
b)
Directly expose the complexity of the subsystem
c)
Hide the complexity of the subsystem behind a simplified interface
d)
Provide a separate interface for each subsystem componen
16.
Which design pattern is used to dynamically add responsibilities to an object?
a)
Adapter
b)
Bridge
c)
Composite
d)
Decorator
17.
The Flyweight design pattern is based on the principle of:
a)
Encapsulation
b)
Inheritance
c)
Composition
d)
Reuse
18.
What is the main purpose of the Proxy design pattern?
a)
To provide a simplified interface for complex subsystems
b)
To allow objects with incompatible interfaces to collaborate
c)
To minimize memory usage by sharing common state
d)
To control access to an object
19.
In the Adapter design pattern, the adaptee class?
a)
Acts as a simplified interface to a complex subsystem
b)
Adds behavior dynamically to an object
c)
Represents part-whole hierarchies
d)
Defines an existing interface that needs to be adapted
20.
Which design pattern is used to provide a surrogate or placeholder for another object to control access to it?
a)
Adapter
b)
Bridge
c)
Proxy
d)
Facade
Reset
