Bird
0
0

In a Chain of Responsibility pattern, what is the expected behavior when a handler receives a request it cannot process?

medium📝 Analysis Q5 of 15
LLD - Behavioral Design Patterns — Part 1
In a Chain of Responsibility pattern, what is the expected behavior when a handler receives a request it cannot process?
AIt forwards the request to the next handler in the chain
BIt throws an exception immediately
CIt processes the request partially and stops the chain
DIt ignores the request and terminates the chain
Step-by-Step Solution
Solution:
  1. Step 1: Understand Chain of Responsibility

    Each handler either processes the request or passes it along the chain.
  2. Step 2: Behavior on unprocessable request

    If a handler cannot process, it forwards to its successor.
  3. Final Answer:

    It forwards the request to the next handler in the chain -> Option A
  4. Quick Check:

    Unprocessable request -> pass along chain [OK]
Quick Trick: Unprocessable requests are passed to next handler [OK]
Common Mistakes:
MISTAKES
  • Assuming immediate exception is thrown
  • Thinking the chain stops abruptly
  • Believing partial processing occurs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes