Bird
Raised Fist0

Which of the following is the correct syntax to define a state enum with states idle, moving_up, and moving_down in a typical low-level design?

easy🧠 Conceptual Q3 of Q15
LLD - Design — Elevator System
Which of the following is the correct syntax to define a state enum with states idle, moving_up, and moving_down in a typical low-level design?
Aenum State: idle, moving_up, moving_down
Benum State = { idle, moving_up, moving_down }
Cenum State { idle, moving_up, moving_down }
Denum State -> idle, moving_up, moving_down
Step-by-Step Solution
Solution:
  1. Step 1: Recall enum syntax

    Standard enum syntax uses curly braces without assignment or arrows.
  2. Step 2: Match options with correct syntax

    enum State { idle, moving_up, moving_down } matches the correct syntax: enum State { idle, moving_up, moving_down }.
  3. Final Answer:

    enum State { idle, moving_up, moving_down } -> Option C
  4. Quick Check:

    Enum syntax uses braces, no equals or arrows [OK]
Quick Trick: Enum uses braces, no equals or arrows [OK]
Common Mistakes:
MISTAKES
  • Using equals sign in enum
  • Using colon instead of braces
  • Using arrow notation incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes