0
0
Cprogramming~10 mins

Enum declaration - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an enum named Color.

C
enum [1] { RED, GREEN, BLUE };
Drag options to blanks, or click blank then click option'
AColors
Bcolor
CColor
DcolorEnum
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or plural forms for enum names.
Forgetting to name the enum.
2fill in blank
medium

Complete 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'
A2
B1
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning duplicate values to enum members.
Starting enum values at 2 when 1 is expected.
3fill in blank
hard

Fix 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'
APriorities
Bpriority
CPRIORITY
DPriority
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase enum names causing confusion.
Using plural or all uppercase names incorrectly.
4fill in blank
hard

Fill 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'
AAction
B1
C0
DState
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural enum names.
Assigning 0 when 1 is expected.
5fill in blank
hard

Fill 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'
ATrafficLight
B1
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the first value when 1 is expected.
Using plural enum names.