Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

What will be the output of the C code?

a)

Hello World! x;

b)

Hello World! followed by a junk value

c)

Compile time error

d)

Hello World!

2.

The format identifier ‘%i’ is also used for _____ data type.

a)

char

b)

int

c)

float

d)

double

3.

What will be the output of the following C code?

a)

2

b)

8

c)

9

d)

10

4.

What will be the output of the following C code?

a)

3 2 3

b)

2 2 3

c)

3 2 2

d)

2 3 3

5.

What will be the output of the following C code?

a)

Run time error

b)

7

c)

8

d)

Depends on compiler

6.

What will be the output of the following C code?

a)

True

b)

False

c)

True False

d)

No Output

7.

Assuming, integer is 2 byte, What will be the output of the program?

a)

ffff

b)

0

c)

8fff

d)

Error

8.

What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

a)

1

b)

2

c)

1 2

d)

Run Time Error

9.

What will be the output of the following C code?

a)

Hi is printed 9 times

b)

Hi is printed 8 times

c)

Hi is printed 7 times

d)

Hi is printed 6 times

10.

What will be the output of the following C code?

a)

H

b)

H is printed infinite times

c)

Compile time error

d)

Varies

11.

What will be the output of the following C code?

a)

hello 5

b)

Error

c)

Nothing

d)

Junk value

12.

What will be the output of the following C code?

a)

Run time error

b)

h h

c)

h e

d)

h l

13.

Which of the following cannot be a structure member?

a)

Another structure

b)

Function

c)

Array

d)

None of the mentioned

14.

What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)

a)

4

b)

8

c)

40

d)

80

15.

What is the default return type if it is not specified in function definition?

a)

void

b)

int

c)

double

d)

short int

16.

What will be the output of the following C code?

a)

Its not zero

b)

Its zero

c)

Run time error

d)

None

17.

What will be the output of the following C code

a)

6 -6 0 0

b)

6 -5 0 1

c)

-6 -6 0 1

d)

6 -6 0 1

18.

What will be the output of the following C code?

a)

Undefined behavior

b)

Output will be 3

c)

Output will be 6

d)

Output will be 5

19.

#include statement must be written __________

a)

Before main()

b)

Before any scanf() / printf()

c)

After main()

d)

It can be written anywhere

20.

Which type of variables can have the same name in a different function?

a)

Global variables

b)

Static variables

c)

Function arguments

d)

Both static variables and Function arguments