0
0
Cprogramming~10 mins

What is C - Interactive Quiz & Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print "Hello, World!" in C.

C
#include <stdio.h>

int main() {
    [1]("Hello, World!\n");
    return 0;
}
Drag options to blanks, or click blank then click option'
Aecho
Bprint
Cprintf
Dcout
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'print' instead of 'printf'.
Using 'cout' which is from C++.
2fill in blank
medium

Complete the code to declare an integer variable named 'age' in C.

C
[1] age = 25;
Drag options to blanks, or click blank then click option'
Avar
Bnum
Cinteger
Dint
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'var' which is not valid in C.
Using 'integer' which is not a C keyword.
3fill in blank
hard

Fix the error in the code to correctly declare a character variable named 'letter'.

C
char [1] = 'A';
Drag options to blanks, or click blank then click option'
Aletter
B1letter
Cchar
Dlet
Attempts:
3 left
💡 Hint
Common Mistakes
Starting variable name with a digit.
Using reserved keywords as variable names.
4fill in blank
hard

Fill both blanks to create a for loop that counts from 0 to 4 in C.

C
for (int i = [1]; i [2] 5; i++) {
    printf("%d\n", i);
}
Drag options to blanks, or click blank then click option'
A0
B<
C<=
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' causes the loop to run one extra time.
Starting the loop at 1 instead of 0.
5fill in blank
hard

Fill all three blanks to declare and initialize an array of 3 integers in C.

C
int [1][[2]] = [3];
Drag options to blanks, or click blank then click option'
Anumbers
B3
C{1, 2, 3}
Darray
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid variable names.
Not using curly braces to initialize the array.