wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

NEXUS'25

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the correct syntax to declare a variable in C?

a)

int num;

b)

int num:

c)

int num = 10.5;

d)

num int;

2.

Which of the following is a correct C identifier?

a)

1variable

b)

_variable1

c)

variable-1

d)

variable 1

3.

What is the size of an int data type in C (on most systems)?

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

8 bytes

4.

What's output of the the following code?

a)

Equal

b)

Not Equal

c)

Error

d)

None of this above

5.

What will be the output of the following code?

a)

5

b)

6

c)

Compilation error

d)

Undefined behavior

6.

What will be the output of the following code?

a)

2 3

b)

3 2

c)

5 1

d)

1 5

7.

What is the output of the following code?

a)

5

b)

10

c)

Compile-time error

d)

Undefined behavior

8.

What is the difference between ++i and i++ in C?

a)

++i increments i after its current value is used, i++ increments i before its current value is used.

b)

++i increments i before its current value is used, i++ increments i after its current value is used.

c)

Both are the same.

d)

++i is a syntax error

9.

What is the output of the following code?

a)

5

b)

4

c)

20

d)

1

10.

What will be the output of the following code?

a)

24

b)

21

c)

20

d)

18

11.

Which of the following is not a valid memory management function in C?

a)

malloc()

b)

calloc()

c)

realloc()

d)

freeall()

12.

Which of the following loops will execute the body at least once, regardless of the condition?

a)

for loop

b)

while loop

c)

do-while loop

d)

None of the above

13.

What is the output of the following code?

a)

0 1 2 3 4

b)

0 1 2 3

c)

0 1 2

d)

1 2 3 4

14.

Which of the following is a valid if statement in C?

a)

if x > 5 then

b)

if (x > 5)

c)

if x > 5;

d)

if (x > 5);

15.

Which of the following is used to take input from the user in C?

a)

printf

b)

scanf

c)

input

d)

cin

16.

Which of the following is a valid way to write a comment in C?

a)

// This is a comment

b)

*This is a comment *

c)

* This is a comment

d)

## This is a commen

17.

What is the correct way to define a constant value in C?

a)

#define PI 3.14

b)

const PI = 3.14

c)

PI = 3.14;

d)

constant PI = 3.14;

18.

C is considered as a _______type language?

a)

High level

b)

Low level

c)

Mid level

d)

None of this

19.

which library is used to get input from user in C?

a)

<Stdio.h>

b)

<math.h>

c)

<conio.h>

d)

<stdio.h>

20.

What will be the output of the following code?

a)

The address of a

b)

20

c)

The value of p

d)

Compile-time error