Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare an enum named Color.
C
enum [1] { RED, GREEN, BLUE }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or plural forms for enum names.
Forgetting to name the enum.
✗ Incorrect
The enum name should be Color to declare the enum properly.
2fill in blank
mediumComplete the code to declare an enum with explicit values.
C
enum Status { PENDING = [1], COMPLETED = 2, FAILED = 3 }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning duplicate values to enum members.
Starting enum values at 2 when 1 is expected.
✗ Incorrect
The first enum value is usually set to 1 here explicitly.
3fill in blank
hardFix the error in the enum declaration by completing the code.
C
enum [1] { LOW, MEDIUM, HIGH }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase enum names causing confusion.
Using plural or all uppercase names incorrectly.
✗ Incorrect
The enum name should be Priority with capital P to follow naming conventions and avoid errors.
4fill in blank
hardFill both blanks to declare an enum and assign a value.
C
enum [1] { START = [2], STOP };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural enum names.
Assigning 0 when 1 is expected.
✗ Incorrect
The enum is named Action and START is assigned the value 1.
5fill in blank
hardFill all three blanks to declare an enum with custom values.
C
enum [1] { RED = [2], GREEN = [3] };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the first value when 1 is expected.
Using plural enum names.
✗ Incorrect
The enum is named TrafficLight, with RED assigned 1 and GREEN assigned 2.