Bird
Raised Fist0

In an order state machine, which scenario represents a valid transition?

easy🧠 Conceptual Q2 of Q15
LLD - Design — Online Shopping Cart

In an order state machine, which scenario represents a valid transition?

AFrom 'Pending' to 'Confirmed'
BFrom 'Delivered' to 'Cancelled'
CFrom 'Cancelled' to 'Shipped'
DFrom 'Shipped' to 'Pending'
Step-by-Step Solution
Solution:
  1. Step 1: Understand valid transitions

    Valid transitions follow the logical order of states in the order lifecycle.
  2. Step 2: Analyze each option

    From 'Delivered' to 'Cancelled' is invalid because once delivered, an order cannot be cancelled. From 'Pending' to 'Confirmed' is valid as 'Pending' orders can move to 'Confirmed'. From 'Cancelled' to 'Shipped' is invalid because cancelled orders cannot be shipped. From 'Shipped' to 'Pending' is invalid because shipped orders cannot revert to pending.
  3. Final Answer:

    From 'Pending' to 'Confirmed' -> Option A
  4. Quick Check:

    Check logical order of states [OK]
Quick Trick: Transitions must follow order lifecycle sequence [OK]
Common Mistakes:
MISTAKES
  • Assuming any state can transition to any other
  • Allowing backward transitions without reason
  • Confusing terminal states with intermediate states

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes