wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Operators

Total questions: 15

Worksheet time: 6mins

Name
Class
Date
1.

In C, the result of the conditional operator is ____________.

a)

true

b)

false

c)

1

d)

0

2.

Select the data types that can be used with the % operator.

a)

int

b)

float

c)

double

d)

all of the above

3.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

4.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

5.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

100 100 100

d)

100 200 300

e)

None of the above

6.

Which bitwise operator is suitable for unsetting a bit in a number?

a)

|

b)

&

c)

^

d)

~

e)

All the above

7.

Which bitwise operator is suitable for setting a bit in a number?

a)

|

b)

&

c)

^

d)

~

e)

All the above

8.

The output of an arithmetic expression with integer and float is __________.

a)

int

b)

float

c)

can't be defined

d)

operation not possible

9.

What is the value of 'a' in the following statement?

int a = 10 + 10.55;

a)

Error

b)

20.55

c)

20

d)

Can't be defined

10.

What is the value of 'a' in the following statement?

int a = 10.55 + 10.55;

a)

20

b)

21

c)

21.10

d)

error

11.

Select the suitable statement to toggle the kth bit of the number 'n'.

a)

n = n | ( 1 << k )

b)

n = n & ( 1 << k )

c)

n = n ^ ( 1 << k )

d)

n = n & ~( 1 << k )

12.

Select the suitable statement to convert a character 'ch' to UPPERCASE.

a)

ch = ch ^ 32

b)

ch = ch | 32

c)

ch = ch & ~32

d)

ch = ch & 32

13.

What is the output of the given code?

a)

10 10

b)

10 100

c)

100 100

d)

10 20

e)

None of the above

14.

Write a statement to check if a positive integer is a power of 2 without using any branching or loop.

4 lines
15.

What do you feel about CRT sessions?

a)

Poor

b)

Average

c)

Good

d)

Excellent