0
0
Cprogramming~10 mins

Variable declaration and initialization - 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 integer variable named age.

C
int [1];
Drag options to blanks, or click blank then click option'
Afloat
B5
Cage
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number instead of a variable name.
Using a data type where the variable name should be.
2fill in blank
medium

Complete the code to initialize the integer variable count with the value 10.

C
int count = [1];
Drag options to blanks, or click blank then click option'
A10
Bcount
C"10"
Dten
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number inside quotes, which makes it a string.
Using the variable name instead of a value.
3fill in blank
hard

Fix the error in the code to declare a floating-point variable named price.

C
[1] price;
Drag options to blanks, or click blank then click option'
Afloat
Binteger
Cdoublee
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling the data type.
Using an integer type for decimal numbers.
4fill in blank
hard

Fill both blanks to declare and initialize a character variable named grade with the value 'A'.

C
char [1] = [2];
Drag options to blanks, or click blank then click option'
Agrade
B'A'
C"A"
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes which makes it a string.
Using the data type as the variable name.
5fill in blank
hard

Fill both blanks to declare and initialize a string variable named name with the value "John".

C
char [1][] = [2];
Drag options to blanks, or click blank then click option'
Aname
B"John"
C'John'
Dstring
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes which is for single characters.
Using string as a data type which is not standard in C.