0
0
Cprogramming~10 mins

Why enumerations are used in C - Test Your Understanding

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

Complete the code to declare an enumeration for days of the week.

C
enum Days { Sunday, Monday, [1], Wednesday, Thursday, Friday, Saturday };
Drag options to blanks, or click blank then click option'
ATuesday
BMonth
CYear
DHour
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated terms like Month or Year instead of a day.
2fill in blank
medium

Complete the code to assign a value to an enumeration constant.

C
enum Color { Red = 1, Green = 2, [1] = 3 };
Drag options to blanks, or click blank then click option'
AYellow
BOrange
CBlue
DPurple
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing colors not listed or unrelated terms.
3fill in blank
hard

Fix the error in the enumeration declaration.

C
enum Status { Active, [1] 5, Pending };
Drag options to blanks, or click blank then click option'
AInactive =
BInactive
CInactive :
DInactive -
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':' or '-' instead of '=' for assignment.
4fill in blank
hard

Fill both blanks to create an enumeration and use it in a variable declaration.

C
enum [1] { Low, Medium, High };
[2] priority;
Drag options to blanks, or click blank then click option'
APriority
Bint
Cenum Priority
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using basic types like int or float instead of enum type.
5fill in blank
hard

Fill all three blanks to define an enumeration and assign a value to a variable.

C
enum [1] { Red, Green, Blue };
enum [2] favoriteColor = [3];
Drag options to blanks, or click blank then click option'
AColor
CGreen
DBlue
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching enum names or assigning invalid values.