wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Behavioral and IOC Design Patterns Quiz

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which pattern allows a request to move through multiple handlers until one handles it?

a)

State

b)

Chain of Responsibility

c)

Strategy

d)

Observer

2.

Which pattern focuses on changing an object’s behavior when its internal state changes?

a)

Chain of Responsibility

b)

Command

c)

State

d)

Mediator

3.

In which pattern does the client usually not know which handler processes the request?

a)

State

b)

Chain of Responsibility

c)

Template Method

d)

Strategy

4.

If every handler in a chain processes a request and passes it forward, which pattern is being used?

a)

State

b)

Observer

c)

Chain of Responsibility

d)

Strategy

5.

Which pattern can result in a request being handled by none of the objects?

a)

State

b)

Strategy

c)

Chain of Responsibility

d)

Template Method

6.

Which pattern typically requires each state to know about the next possible state?

a)

Observer

b)

Chain of Responsibility

c)

State

d)

Mediator

7.

Why is Chain of Responsibility preferred over a large if-else block?

a)

Faster execution

b)

Better UI design

c)

Decouples sender from handler

d)

Reduces memory usage

8.

What is a common drawback of Chain of Responsibility?

a)

Too many objects created

b)

Hard to guarantee request handling

c)

Difficult to extend

d)

Tight coupling

9.

State pattern helps mainly to:

a)

Avoid subclassing

b)

Replace conditional logic with polymorphism

c)

Simplify object creation

d)

Control access to objects

10.

Which difference is TRUE?

a)

State decides who handles a request

b)

Chain of Responsibility changes object behavior

c)

State represents behavior based on condition

d)

Chain of Responsibility replaces algorithms

11.

A support ticket moves through L1 → L2 → L3 support until resolved. Which pattern best fits?

a)

State

b)

Chain of Responsibility

c)

Strategy

d)

Observer

12.

An order can be Created, Paid, Cancelled, or Shipped, and each state allows different actions. Which pattern fits best?

a)

Chain of Responsibility

b)

Decorator

c)

State

d)

Factory

13.

A document approval system sends a request to Manager → Director → CEO, but approval may stop at any level. Which pattern is used?

a)

State

b)

Chain of Responsibility

c)

Command

d)

Mediator

14.

A media player behaves differently when in Playing, Paused, or Stopped modes. Which pattern applies?

a)

Strategy

b)

Chain of Responsibility

c)

State

d)

Observer

15.

What's a potential disadvantage of the State pattern?

a)
  • It makes code less maintainable

b)
  • Can increase the number of classes significantly

c)
  • Cannot handle state transitions

d)
  • Violates Single Responsibility Principle