Bird
Raised Fist0

Given an elevator state machine with states: Idle, MovingUp, MovingDown, DoorOpen. If the elevator is Idle and receives a 'GoUp' event, what is the next state?

medium📝 Analysis Q4 of Q15
LLD - Design — Elevator System
Given an elevator state machine with states: Idle, MovingUp, MovingDown, DoorOpen. If the elevator is Idle and receives a 'GoUp' event, what is the next state?
ADoorOpen
BMovingUp
CIdle
DMovingDown
Step-by-Step Solution
Solution:
  1. Step 1: Identify current state and event

    Current state is Idle; event is 'GoUp'.
  2. Step 2: Determine transition based on event

    'GoUp' event triggers transition from Idle to MovingUp state.
  3. Final Answer:

    MovingUp -> Option B
  4. Quick Check:

    Idle + GoUp = MovingUp [OK]
Quick Trick: GoUp event moves elevator to MovingUp state [OK]
Common Mistakes:
MISTAKES
  • Choosing DoorOpen instead of MovingUp
  • Staying in Idle state incorrectly
  • Confusing MovingDown with MovingUp

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes