wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Quiz 1

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

How many keywords are there in C Language ?

a)

30

b)

22

c)

32

d)

36

2.

What will be the output of the given code?

a)

4 6

b)

4 4

c)

6 6

d)

6 4

3.

What will be the output of the given code?

a)

34

b)

garbage error

c)

compilation error

d)

runtime error

4.

What will be the output of the given code?

a)

4

b)

5

c)

6

d)

7

5.

What will be the output of the given code?

a)

1

b)

0

c)

12

d)

6

6.

What will be the output of the given code?

a)

Temperature in Fahrenheit is 41.00

b)

Temperature in Fahrenheit is 37.00

c)

Temperature in Fahrenheit is 0.00

d)

Compilation Error

7.

What will be the output of the given code?

a)

12

b)

Compilation Error

c)

Garbage

d)

10

8.

What will be the output of the given code?

a)

7

b)

0

c)

1

d)

6

9.

What will be the output of the given code?

a)

3

b)

0

c)

1

d)

2

10.

Which of the following declarations are invalid?

1. short int x;

2. signed short x;

3. short x;

4 .unsigned short x;

a)

All are valid

b)

3 and 4

c)

1

d)

2

11.

What will be the output of the given code?

a)

135

b)

+INF

c)

-121

d)

-8

12.

What will be the output of the given code?

a)

266

b)

-121

c)

+INF

d)

9

13.

What will be the output of the given code?

a)

same

b)

not same

14.

What will be the output of the given code?

a)

same

b)

not same

15.

float x = 2.17;

double y = 2.17;

long double z = 2.17;

a)

printf("%f %lf %Lf",x,y,z);

b)

printf(“%f %f %f”,x,y,z);

c)

printf("%f %ff %fff",x,y,z);

d)

printf("%f %lf %llf",x,y,z);

16.

Which of the following is the correct way to define a constant 'PI' with a value of 3.14 in C?

a)

#define PI 3.14

b)

const float PI = 3.14;

c)

PI = 3.14;

d)

define PI 3.14;

17.

What will be the output?

a)

1

b)

2

c)

3

d)

4

18.

What will be the output?

a)

5

b)

address of 'x'

c)

Garbage Value

d)

Error

19.

What will be the output?

a)

15

b)

25

c)

Address of 'a' + Address of 'b'

d)

Error

20.

What will be the value of x after the following lines are executed?

int x = 5;

int ptr = &x;

*ptr = 10;

a)

5

b)

10

c)

Address of x

d)

Error