Bird
0
0

Which of the following is the correct syntax to define an enum VehicleType with values CAR, BIKE, and TRUCK?

easy🧠 Conceptual Q12 of 15
LLD - Design — Parking Lot System
Which of the following is the correct syntax to define an enum VehicleType with values CAR, BIKE, and TRUCK?
Aenum VehicleType = [CAR, BIKE, TRUCK]
Benum VehicleType { CAR, BIKE, TRUCK }
CVehicleType = enum(CAR, BIKE, TRUCK)
Denum VehicleType: CAR, BIKE, TRUCK
Step-by-Step Solution
Solution:
  1. Step 1: Recall enum declaration syntax

    Standard enum syntax uses curly braces with comma-separated values.
  2. Step 2: Match syntax to options

    enum VehicleType { CAR, BIKE, TRUCK } matches the correct syntax: enum VehicleType { CAR, BIKE, TRUCK }.
  3. Final Answer:

    enum VehicleType { CAR, BIKE, TRUCK } -> Option B
  4. Quick Check:

    Enum syntax = curly braces + commas [OK]
Quick Trick: Enums use braces and commas for values [OK]
Common Mistakes:
MISTAKES
  • Using equal sign instead of braces
  • Using square brackets for enums
  • Missing commas between values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes