wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz 1 - Intro to C

Total questions: 10

Worksheet time: 18mins

Name
Class
Date
1.

Declare an integer variable named num.

a)

float num;

b)

int num;

c)

char num;

d)

double num;

2.

Initialize the variable num to 0.

a)

num == 0;

b)

0

c)

num = 0;

d)

int num = 0;

3.

Read and store the value entered by user to num.

a)

scanf (“%i”, &num);

b)

scanf ("%f", &num);

c)

"%i", #

d)

scanf ("%i", num);

4.

4.Multiply the current value of num into 2 and assign the new value to num.

a)

num =+ 2;

b)

num = num * num;

c)

num = 2 * 2;

d)

num = num * 2;

5.

5.Display the value of num.

a)

printf (The value of num is: num);

b)

printf ("The value of num is: %i,);

c)

printf ("The value of num is:%i, num);

d)

printf ("The value of num is: %i, &num);

6.

Declare a floating points number named val.

4 lines
7.

Initialize the variable val to 1.

4 lines
8.

Read and store the value entered by user to val

4 lines
9.

Multiply the current value of val into 2 and assign the new value to val.

4 lines
10.

Display the value of val with 3 decimal points

4 lines