Bird
0
0

A developer wrote this transition: if (state == 'DoorOpen') state = 'MovingUp'; but the elevator never closes doors before moving. What is the problem?

medium📝 Analysis Q7 of 15
LLD - Design — Elevator System
A developer wrote this transition: if (state == 'DoorOpen') state = 'MovingUp'; but the elevator never closes doors before moving. What is the problem?
AMovingUp state should come before DoorOpen
BMissing a DoorClose state before MovingUp
CDoorOpen state should be skipped
DState transitions are not needed
Step-by-Step Solution
Solution:
  1. Step 1: Understand elevator door behavior

    Doors must close before elevator moves to avoid safety issues.
  2. Step 2: Identify missing state

    Transition should include DoorClose state before MovingUp to simulate door closing.
  3. Final Answer:

    Missing a DoorClose state before MovingUp -> Option B
  4. Quick Check:

    DoorClose needed before MovingUp [OK]
Quick Trick: Doors must close before moving [OK]
Common Mistakes:
MISTAKES
  • Skipping door closing state
  • Incorrect state order
  • Ignoring safety in transitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes