Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a constant integer named MAX with value 100.
C
const int MAX = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable name instead of value
Forgetting to assign a value
✗ Incorrect
The constant MAX is assigned the literal value 100.
2fill in blank
mediumComplete the code to assign the character literal 'A' to the variable letter.
C
char letter = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes for characters
Omitting quotes around the character
✗ Incorrect
Character literals in C use single quotes, like 'A'.
3fill in blank
hardFix the error in the code by completing the constant declaration for PI with value 3.14.
C
const float PI = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma instead of dot for decimals
Using string literal instead of numeric literal
✗ Incorrect
Float literals should have an 'f' suffix to specify float type in C.
4fill in blank
hardFill both blanks to create a constant double named gravity with value 9.8.
C
const [1] gravity = [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using float type instead of double
Adding 'f' suffix to double literal
✗ Incorrect
Use 'double' type for gravity and assign the literal 9.8 without suffix.
5fill in blank
hardFill all three blanks to declare a constant string pointer named greeting with value "Hello".
C
const [1] [2] = [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'string' type which is not standard in C
Missing pointer symbol '*' for string pointer
✗ Incorrect
Strings in C are char pointers. Use 'const char * greeting = "Hello";'.