0
0
Cprogramming~10 mins

Basic data types - 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'
Acount
Bnumber
Cvalue
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Using a keyword as a variable name
Forgetting the semicolon at the end
2fill in blank
medium

Complete the code to declare a floating-point variable named price.

C
float [1];
Drag options to blanks, or click blank then click option'
Aamount
Bprice
Ccost
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using an integer type instead of float
Misspelling the variable name
3fill in blank
hard

Fix the error in the code by completing the declaration of a character variable named grade.

C
char [1];
Drag options to blanks, or click blank then click option'
Amark
Bletter
Cgrade
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string type instead of char
Using an incorrect variable name
4fill in blank
hard

Fill both blanks to declare a double variable named distance and initialize it to 100.5.

C
double [1] = [2];
Drag options to blanks, or click blank then click option'
Adistance
B100.5
CdistanceValue
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using an integer value instead of a floating-point number
Using a different variable name
5fill in blank
hard

Fill all three blanks to declare a boolean variable named isValid, initialize it to true, and print it using printf.

C
#include <stdio.h>
#include <stdbool.h>

int main() {
    bool [1] = [2];
    printf("Is valid: %d\n", [3]);
    return 0;
}
Drag options to blanks, or click blank then click option'
AisValid
Btrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to include stdbool.h
Using True instead of true
Printing the variable name incorrectly