wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

structural Design Patterns Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A client needs to place an order but must call Inventory, Payment, Shipping, and Notification services in the correct order. Which pattern can simplify this interaction?

a)

Decorator

b)

Adapter

c)

Facade

d)

Proxy

2.

Which situation best indicates the need for a Facade?

a)

Adding new behavior to an object at runtime

b)

Hiding complex subsystem interactions behind a single method

c)

Converting one interface into another

d)

Restricting access to an object

3.

You want to add logging, caching, and validation to a service without changing its existing code. Which pattern fits best?

a)

Facade

b)

Decorator

c)

Adapter

d)

Singleton

4.

What is the main benefit of using a Facade?

a)

Improves performance

b)

Reduces number of classes

c)

Reduces coupling between client and subsystems

d)

Enables multiple inheritance

5.

Which scenario best suits the Decorator pattern?

a)

Simplifying a complex workflow

b)

Creating related objects together

c)

Adding responsibilities dynamically

d)

Ensuring only one object exists

6.

Why is Decorator preferred over inheritance in some cases?

a)

It improves compile-time safety

b)

It avoids deep inheritance hierarchies

c)

It guarantees faster execution

d)

It removes the need for interfaces

7.

A notification system supports Email. Later, SMS and Push must be added in any combination at runtime. Which pattern solves this without creating many subclasses?

a)

Facade

b)

Builder

c)

Decorator

d)

Factory

8.

A client calls a single method PlaceOrder() instead of interacting with five different services. Which pattern is being used?

a)

Proxy

b)

Decorator

c)

Facade

d)

Adapter

9.

Which statement best differentiates Facade from Decorator?

a)

Facade adds behavior; Decorator hides complexity

b)

Facade simplifies usage; Decorator enhances behavior

c)

Both modify object behavior

d)

Both wrap objects for security

10.

If adding a new feature requires wrapping an existing object rather than modifying it, which principle is mainly supported?

a)

Single Responsibility Principle

b)

Open/Closed Principle

c)

Dependency Inversion Principle

d)

Interface Segregation Principle