QuizzesChain of Responsibility — Concept Check
intermediate
lld

Chain of Responsibility — Concept Check

Questions on Chain of Responsibility. Passes a request along a chain of handlers, each deciding to process it or forward it to the next handler.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Chain of Responsibility — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.In a logging system using the Chain of Responsibility pattern, a message with level WARN is logged. The chain consists of ConsoleLogger (DEBUG+), FileLogger (WARN+), and AlertLogger (ERROR+). Which loggers will handle the message?

    • AOnly AlertLogger
    • BConsoleLogger and FileLogger
    • COnly FileLogger
    • DFileLogger and AlertLogger
  2. 2.A developer implements a validation chain for user registration. If the username is too short, what happens next in a strict validation chain?

    • AThe request is accepted
    • BThe chain stops and returns an error
    • CThe next validator is called
    • DThe chain continues without error
  3. 3.Which of the following is a characteristic of the Chain of Responsibility pattern?

    • AHandlers decide whether to process or forward requests
    • BHandlers cannot be assembled at runtime
    • CHandlers are tightly coupled to the sender
    • DHandlers must process every request
  4. 4.In a Chain of Responsibility pattern, why might debugging become difficult as the chain grows longer?

    • AThe chain always processes every request
    • BHandlers can be skipped, making flow unpredictable
    • CHandlers are always synchronous
    • DHandlers are hard-coded and cannot be changed
  5. 5.A validation chain consists of UsernameValidator, EmailValidator, and PasswordValidator. If a request has an invalid email, what is the outcome?

    • AThe request is accepted
    • BThe chain skips to the end
    • CThe chain stops and returns an error
    • DThe chain continues to PasswordValidator
  6. 6.When using Chain of Responsibility, what happens if no handler processes the request?

    • AThe request is processed by a default handler
    • BThe request is returned to the sender
    • CThe request is ignored
    • DAn error is thrown
  7. 7.In the logger chain example, what is the role of the 'next' reference in each handler?

    • ATo store log messages
    • BTo forward the request to the next handler
    • CTo process the request
    • DTo terminate the chain
  8. 8.A common belief is that the Chain of Responsibility pattern always processes every request. Why is this incorrect?

    • AHandlers can choose not to forward requests
    • BHandlers modify requests before forwarding
    • CRequests are always processed by the last handler
    • DThe chain processes every request by default