Bird
Raised Fist0

You implemented the Observer pattern but observers are not notified when the subject changes. What is the most likely cause?

medium📝 Analysis Q6 of Q15
LLD - Behavioral Design Patterns — Part 2
You implemented the Observer pattern but observers are not notified when the subject changes. What is the most likely cause?
ASubject does not maintain a state
BObservers are not registered with the subject
CObservers do not implement the update method
DSubject calls update on observers
Step-by-Step Solution
Solution:
  1. Step 1: Check observer registration

    Observers must be registered with the subject to receive notifications.
  2. Step 2: Identify missing registration

    If observers are not registered, they won't be notified despite subject changes.
  3. Final Answer:

    Observers are not registered with the subject -> Option B
  4. Quick Check:

    Missing registration = No notifications [OK]
Quick Trick: Register observers to get notified [OK]
Common Mistakes:
MISTAKES
  • Assuming subject state is mandatory
  • Ignoring observer interface implementation
  • Thinking subject calls update incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes