QuizzesFilter / Chain of Responsibility Pattern — Concept Check
intermediate
lld

Filter / Chain of Responsibility Pattern — Concept Check

Questions on Filter / Chain of Responsibility Pattern. Passes a request along a chain of handlers where each handler either processes it, enriches it, or forwards 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 Filter / Chain of Responsibility Pattern — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.In a logging workflow using the Chain of Responsibility pattern, what happens when a Team Lead Approver receives an expense request of ₹1,500?

    • AThe request is forwarded to the Manager Approver.
    • BThe request is forwarded to the Director Approver.
    • CThe Team Lead Approver approves the request.
    • DThe request is denied.
  2. 2.A developer implements a filter chain in a web application, but notices that requests are not reaching certain filters. What could be a likely cause?

    • AThe response object is not being modified.
    • BThe filters are not ordered correctly in the chain.
    • CThe request object is not initialized properly.
    • DA filter is short-circuiting by not calling chain.doFilter().
  3. 3.In the Chain of Responsibility pattern, what is the role of the 'next' reference in a handler?

    • ATo store the result of the request processing.
    • BTo initialize the handler with default values.
    • CTo pass the request to the next handler in the chain.
    • DTo terminate the request processing.
  4. 4.A developer claims that the Filter Chain pattern does not allow for short-circuiting. What is the flaw in this statement?

    • AFilter chains can short-circuit by not calling chain.doFilter().
    • BFilter chains require all filters to be executed.
    • CFilter chains always process all filters.
    • DFilter chains are the same as Chain of Responsibility.
  5. 5.What happens if a Director Approver receives an expense request of ₹8,000 in a Chain of Responsibility pattern?

    • AThe request is sent back to the Team Lead Approver.
    • BThe request is denied.
    • CThe Director Approver approves the request.
    • DThe request is forwarded to the next handler.
  6. 6.In a filter chain, an AuthFilter checks for a valid token. If the token is invalid, what should happen next?

    • AThe request is forwarded to the next filter.
    • BThe request is logged and forwarded.
    • CThe response is set to 200 and the chain continues.
    • DThe response is set to 401 and the chain is short-circuited.
  7. 7.A developer argues that in a Chain of Responsibility, each handler must process the request fully. What is incorrect about this view?

    • AHandlers must log every request.
    • BHandlers can forward requests if they can't process them.
    • CHandlers always reject unprocessable requests.
    • DHandlers must process requests fully.
  8. 8.What is a key difference between a Filter Chain and a classic Chain of Responsibility pattern?

    • AFilter chains require all filters to execute.
    • BFilter chains can short-circuit requests.
    • CHandlers in a Chain of Responsibility cannot forward requests.
    • DHandlers in a Chain of Responsibility always process requests fully.