Bird
0
0

Which component in the Memento pattern is responsible for storing the internal state of the Originator?

easy🧠 Conceptual Q2 of 15
LLD - Behavioral Design Patterns — Part 2
Which component in the Memento pattern is responsible for storing the internal state of the Originator?
AMemento
BOriginator
CCaretaker
DClient
Step-by-Step Solution
Solution:
  1. Step 1: Identify roles in Memento pattern

    The Originator creates a Memento containing a snapshot of its current internal state. The Memento stores this state.
  2. Step 2: Match component to responsibility

    The Memento is the object that stores the internal state. Caretaker manages Mementos but does not store state.
  3. Final Answer:

    Memento -> Option A
  4. Quick Check:

    State storage = Memento [OK]
Quick Trick: Memento stores state, Caretaker manages it [OK]
Common Mistakes:
MISTAKES
  • Confusing Caretaker as state holder
  • Thinking Originator stores previous states
  • Assuming Client stores state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes