Bird
0
0

Consider a system using the Mediator pattern to manage communication. What is the expected output when a component sends a message through the mediator?

medium📝 Analysis Q13 of 15
LLD - Behavioral Design Patterns — Part 2
Consider a system using the Mediator pattern to manage communication. What is the expected output when a component sends a message through the mediator?
AThe mediator handles and routes the message to appropriate components.
BThe message is broadcast to all components directly.
CThe message is ignored unless the sender handles it.
DThe message causes the system to crash due to tight coupling.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Mediator pattern role

    Mediator centralizes communication, routing messages between components.
  2. Step 2: Analyze message flow

    Messages go through mediator, which decides recipients, avoiding direct component coupling.
  3. Final Answer:

    The mediator handles and routes the message to appropriate components. -> Option A
  4. Quick Check:

    Mediator routes messages = A [OK]
Quick Trick: Mediator centralizes communication flow [OK]
Common Mistakes:
MISTAKES
  • Assuming direct broadcast without mediator
  • Thinking messages are ignored
  • Believing mediator causes crashes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes