wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Basic

Total questions: 10

Worksheet time: 20mins

Name
Class
Date
1.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

printf("Hello World! %d \n", x);

return 0;

}

a)

Hello World! x;

b)

Hello World! followed by a junk value

c)

Compile time error

d)

Hello World!

2.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int y = 10000;

int y = 34;

printf("Hello World! %d\n", y);

return 0;

}

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

3.

What is the size of an int data type?

a)

4 Bytes

b)

2 Bytes

c)

Depends on the system/compiler

d)

Cannot be determined

4.

Which is correct with respect to the size of the data types?

a)

char > int > float

b)

int > char > float

c)

char < int < double

d)

double > char > int

5.

Find an integer.

a)

13.5

b)

13

c)

"13"

d)

None of the above

6.

Number of Keywords present in C Language are .?

a)

32

b)

34

c)

36

d)

40

7.

Each statement in a C program should end with.?

a)

Semicolon ;

b)

Colon :

c)

Period . (dot symbol)

d)

None of the above.

8.

Correct way of commenting a single line is.?

a)

/*printf("Hello C..");

printf("How are you.");

b)

//printf("Hello C..");

printf("How are you.");

c)

/*printf("Hello C..");

printf("How are you.");*/

d)

/printf("Hello C..");/

printf("How are you.");

9.

An Identifier may contain.?

a)

Letters a-z, A-Z in Basic character set. Unicode alphabet characters other languages

b)

Underscore _ symbol

c)

Numbers 0 to 9 Unicode Numbers in other languages

d)

All the above

10.

Find a correct C Keyword below.

a)

go to

b)

breaker

c)

shorter

d)

default