wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DAY 2 - C& C++ Assessment _11th & 12th June 24

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following operators has the highest precedence in C?

a)

+ (Addition)

b)

* (Multiplication)

c)

&& (Logical AND)

d)

= (Assignment)

2.

will be the output of the following C code snippet?

a)

30

b)

25

c)

20

d)

15

3.

Which of the following is a bitwise operator in C?

a)

&&

b)

||

c)

&

d)

==

4.

What will be the output of the following C code snippet?

a)

Positive

b)

Negative

c)

Compilation error

d)

No output

5.

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

a)

for loop

b)

while loop

c)

do-while loop

d)

Infinite loop

6.

What is the output of the following C code snippet?

a)

0 1 2 3

b)

0 1 2

c)

1 2 3

d)

1 2

7.

Which of the following statements is true about the switch statement in C?

a)

The switch statement can evaluate only integer expressions.

b)

The switch statement can evaluate any type of expression.

c)

The switch statement is limited to two cases.

d)

The switch statement must always include a default case.

8.

What is the output of the following C code snippet?

a)

7

b)

12

c)

34

d)

Compilation error

9.

What is the base case in the following recursive function to calculate the factorial of a number?

a)

if (n == 1)

b)

if (n == 0)

c)

if (n < 0)

d)

No base case

10.

Which of the following statements is true about functions in C?

a)

Functions cannot return a value.

b)

Functions can have default arguments.

c)

Functions can call themselves.

d)

Functions cannot take parameters.