0
0
Cprogramming~10 mins

Constants and literals - 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 a constant integer named MAX with value 100.

C
const int MAX = [1];
Drag options to blanks, or click blank then click option'
Aint
B100
CMAX
Dconst
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable name instead of value
Forgetting to assign a value
2fill in blank
medium

Complete 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'
A'A'
B"a"
CA
D"A"
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes for characters
Omitting quotes around the character
3fill in blank
hard

Fix 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'
A3,14
B"3.14"
C3.14f
D3.14
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma instead of dot for decimals
Using string literal instead of numeric literal
4fill in blank
hard

Fill 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'
Adouble
Bfloat
C9.8
D9.8f
Attempts:
3 left
💡 Hint
Common Mistakes
Using float type instead of double
Adding 'f' suffix to double literal
5fill in blank
hard

Fill 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'
Achar
B*
C"Hello"
Dstring
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'string' type which is not standard in C
Missing pointer symbol '*' for string pointer