Bird
0
0

What is the main purpose of the Memento pattern in system design?

easy🧠 Conceptual Q11 of 15
LLD - Behavioral Design Patterns — Part 2
What is the main purpose of the Memento pattern in system design?
ATo create multiple instances of an object efficiently
BTo convert one interface to another compatible interface
CTo manage concurrent access to shared resources
DTo save and restore an object's state without exposing its internal details
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of Memento pattern

    The Memento pattern is designed to capture and externalize an object's internal state so that it can be restored later without exposing the object's implementation details.
  2. Step 2: Compare with other design patterns

    Other options describe different patterns: A is about object creation (Factory), C is about synchronization (Mutex), D is about interface compatibility (Adapter).
  3. Final Answer:

    To save and restore an object's state without exposing its internal details -> Option D
  4. Quick Check:

    Memento = Save & Restore State [OK]
Quick Trick: Memento = save state secretly, no details shown [OK]
Common Mistakes:
MISTAKES
  • Confusing Memento with Factory or Adapter patterns
  • Thinking it manages concurrency
  • Assuming it changes object interfaces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes