Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated terms like Month or Year instead of a day.
✗ Incorrect
The enumeration for days of the week includes Tuesday as the third day.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing colors not listed or unrelated terms.
✗ Incorrect
The enumeration assigns Blue the value 3.
3fill in blank
hardFix the error in the enumeration declaration.
C
enum Status { Active, [1] 5, Pending }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':' or '-' instead of '=' for assignment.
✗ Incorrect
Enumeration constants must be assigned values using the '=' sign, so Inactive = is correct.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using basic types like int or float instead of enum type.
✗ Incorrect
The enum is named Priority, and the variable priority is declared with type enum Priority.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching enum names or assigning invalid values.
✗ Incorrect
The enum is named Color, the variable favoriteColor is declared as enum Color, and assigned the value Green.