Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare an enum for vehicle types.
LLD
enum VehicleType { [1] } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or numeric values instead of identifiers.
✗ Incorrect
The enum values should be uppercase identifiers separated by commas.
2fill in blank
mediumComplete the code to declare an enum for parking spot types.
LLD
enum SpotType { [1] } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or numbers instead of identifiers.
✗ Incorrect
Enum values should be uppercase and represent spot categories.
3fill in blank
hardFix the error in the enum declaration for VehicleType.
LLD
enum VehicleType { CAR, BIKE, [1] } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or numeric values in enum.
✗ Incorrect
Enum values must be uppercase identifiers, so TRUCK is correct.
4fill in blank
hardFill both blanks to complete the enum and use it in a variable declaration.
LLD
enum SpotType { [1] }
SpotType mySpot = [2]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning variable without enum prefix or using lowercase values.
✗ Incorrect
The enum must list all spot types, and the variable should be assigned using the enum type prefix.
5fill in blank
hardFill all three blanks to declare VehicleType enum, assign a variable, and compare it.
LLD
enum VehicleType { [1] }
VehicleType myVehicle = [2];
if (myVehicle == [3]) {
// park vehicle
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or missing enum prefix in assignment or comparison.
✗ Incorrect
Enum declaration uses uppercase values, variable assigned with enum prefix, and comparison uses enum prefix as well.
