Bird
0
0

Which component in the Command pattern is responsible for storing commands to support undo?

easy🧠 Conceptual Q2 of 15
LLD - Design — Tic-Tac-Toe Game
Which component in the Command pattern is responsible for storing commands to support undo?
AReceiver
BInvoker
CClient
DCommand Interface
Step-by-Step Solution
Solution:
  1. Step 1: Identify roles in Command pattern

    The Invoker calls commands and keeps a history stack of executed commands.
  2. Step 2: Understand undo support

    Storing commands in Invoker allows undo by calling undo on last command.
  3. Final Answer:

    Invoker -> Option B
  4. Quick Check:

    Undo storage = Invoker [OK]
Quick Trick: Invoker manages command history for undo [OK]
Common Mistakes:
MISTAKES
  • Confusing Receiver as command storage
  • Thinking Client stores commands
  • Assuming Command Interface stores history

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes