Bird
0
0

Which of the following correctly represents the key components of the Memento pattern?

easy🧠 Conceptual Q12 of 15
LLD - Behavioral Design Patterns — Part 2
Which of the following correctly represents the key components of the Memento pattern?
ASubject, Observer, ConcreteObserver
BOriginator, Memento, Caretaker
CClient, Proxy, RealSubject
DComponent, Decorator, ConcreteComponent
Step-by-Step Solution
Solution:
  1. Step 1: Identify components of Memento pattern

    The Memento pattern consists of three main parts: Originator (the object whose state is saved), Memento (the object storing the state), and Caretaker (manages mementos).
  2. Step 2: Eliminate other patterns

    Options B, C, and D correspond to Observer, Proxy, and Decorator patterns respectively, which are unrelated to Memento.
  3. Final Answer:

    Originator, Memento, Caretaker -> Option B
  4. Quick Check:

    Components = Originator + Memento + Caretaker [OK]
Quick Trick: Remember 3 parts: Originator, Memento, Caretaker [OK]
Common Mistakes:
MISTAKES
  • Mixing Memento components with Observer or Proxy
  • Forgetting the Caretaker role
  • Confusing Memento with Decorator pattern

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes