Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Operators in C

Total questions: 24

Worksheet time: 11mins

Name
Class
Date
1.

int x;

int y;

int z;

x=3;

y=4;

z = ++x * y++;

printf("%d",z);

a)

12

b)

16

c)

20

d)

0

2.

In C programming language, which of the following type of operators have the highest precedence

a)

Relational operators

b)

Equality operators

c)

Logical operators

d)

Arithmetic operators

3.

Which of the following comments about the ++ operator are correct?

1) It is a unary operator

2) The operand can come before or after the operator

3)It associates from the right

a)

1 and 3

b)

1 and 2

c)

2 and 3

d)

1,2,3

4.

int main()

{

int a = 25%10;

printf("%d", a);


return 0;

}

a)

5

b)

2

c)

2.5

d)

5.5

5.

++ and -- are unary operators.

a)

True

b)

False

6.

Which of the following is not a Bitwise operator?

a)

&

b)

|

c)

<<

d)

&&

7.

The _____________ operator checks if the value of left operand is greater than the value of right operand.

a)

= =

b)

<

c)

>

d)

=

8.

#include <stdio.h>


int main()

{


int i = 95;


char c = 97;


printf("%d, %d\n", sizeof(i), sizeof(c));


return 0;

}

a)

4,1

b)

4,2

c)

2,4

d)

2,8

9.

#include <stdio.h>


void main()

{


int x = 5 * 9 / 3 + 9;

printf ("%d",x);


}

a)

24

b)

3

c)

23

d)

4

10.

#include <stdio.h>

int main() {

int y = 2;

int z = y +(y = 10);

printf("%d\n", z);

}

a)

12

b)

20

c)

Either 12 or 20

d)

4

11.

void main()

{

int a, b = 2, c;

a = 2 * (b++);

c = 2 * (++b);

}

a)

a = 4, c = 8

b)

a = 3, c = 8

c)

b = 3, c = 6

d)

a = 4, c = 6

12.

16>>2

a)

4

b)

8

c)

32

d)

64

13.

What is the other name for C Language ?: Question Mark Colon Operator.?

a)

Comparison Operator

b)

If-Else Operator

c)

Binary Operator

d)

Ternary Operator

14.

Which of the following is not a compound assignment operator?

a)

+=

b)

/=

c)

%=

d)

==

15.

What is the output of the following printf


printf("%d",34+24/12%3*5/2-4);

a)

35

b)

-2

c)

34

d)

38

16.

What is the output of the following code:

#include<stdio.h>

void main()

{

int a=10,b=80,c=45;

printf("%d",a<b>c);

}

a)

0

b)

1

c)

10

d)

Error

17.

What is the output of the following code:

#include<stdio.h>

void main()

{

int a=10,b=-5;

printf("%d",a&&b);

}

a)

1

b)

0

c)

Error

d)

10

e)

-5

18.

What is the output of the following printf


int a=9;

printf("%d",~a);

a)

10

b)

-10

c)

6

d)

-9

19.

What is the output of the following printf


int a=-11;

printf("%d",!a);

a)

0

b)

1

c)

12

d)

10

20.

What is the output of the following printf:


int a=6,b=8;

printf("%d",a^b);

a)

14

b)

0

c)

6

d)

8

21.

What is the output of the following printf:


int a=10,b=3;

printf("%d",a<<b);

a)

80

b)

0

c)

20

d)

40

22.

What is the output of the following code snippet:


int a=12;

a?printf("GEC"):printf("IT");

a)

GEC

b)

IT

c)

GECIT

d)

Error

23.

What is the output of the following printf:


int a=10,b=8;

printf("%d",a+~b);

a)

1

b)

18

c)

19

d)

2

24.

Which operators perform operations on data in binary level?

a)

Logical operator

b)

Bitwise operator

c)

Additional opertors

d)

None of the above