wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PVP_Operators in C

Total questions: 50

Worksheet time: 1hrs 15mins

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.

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

3.

int main()

{

int a = 25%10;

printf("%d", a);


return 0;

}

a)

5

b)

2

c)

2.5

d)

5.5

4.

!= is the example of ____________________ operator.

a)

Relational

b)

Logical

c)

Assignment

d)

Conditional

5.

#include <stdio.h>


int main()

{


int i = 95;


char c = 97;


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


return 0;

}

a)

2,1

b)

4,2

c)

2,4

d)

2,8

6.

#include <stdio.h>


void main()

{


int x = 5 * 9 / 3 + 9;


}

a)

24

b)

3

c)

23

d)

4

7.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

8.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

9.

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

a)

|

b)

&

c)

^

d)

~

e)

All the above

10.

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

11.

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

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.

++X - Identify the corresponding operator:

a)

Post Increment

b)

Increment

c)

Pre Increment

d)

None of these

15.

int x = 15;

(x>0)?printf("x is greater"):printf("x having negative values")

Find the Output.

a)

Error

b)

x is greater

c)

x having negative values

d)

None of these

16.

int x = 15, y=10;

if(x>20 && y<=10)

printf("Condition Satisfied");

else

printf("Condition not satisfied");

a)

Error

b)

Condition Satisfied

c)

Condition not Satisfied

d)

None of these

17.

1011 & 0111

a)

1000

b)

0011

c)

1011

d)

None of these

18.

In an expression involving || operator, evaluation

I. Will be stopped if one of its components evaluates to false

II. Will be stopped if one of its components evaluates to true

III. Takes place from right to left

IV. Takes place from left to right

a)

I and II

b)

I and III

c)

II and III

d)

II and IV

19.

#include <stdio.h>

int main() {

int age=20;

age>=18? printf("eligible") : printf("not eligible");

return 0; }

a)

eligible

b)

not elgible

20.

#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

21.

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

22.

char name[10];

float m1;

printf("Enter the name and cutoff of yours");

scanf("---------",name,&m1);

a)

%s%f

b)

%c%f

c)

%s%lf

23.

int a;

flloat b;

char n[10];

printf("Enter a,b n values");

scanf("%d%f%s",----------);

a)

&a,&b,&n

b)

&b,&a,&n

c)

&a,&b,n

d)

a,b,n

24.
a)

inside if

b)

inside elseif

c)

inside ifinside elseif

d)

compile time error

25.

a)

COMPILE TIME ERROR

b)

0.3

c)

0.2

d)

0.1

e)

0

26.

a)

HELLO

b)

Prints Nothing

c)

HELLO HI

d)

HI

27.

a)

1)i<j

2)i<j

b)

1)i>j

2)i>j

c)

1)i<j

2)i>j

d)

1)i>j

2)i<j

28.

a)

a%2==1

b)

a%2<1

c)

a%2>1

d)

a%2==0

29.

Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?

a = ( x > y ) ? (( x > z ) ? x : z) : (( y > z ) ? y : z )

a)

x : 6, y : 5, z : 3

b)

x : 6, y : 3, z : 5

c)

x : 3, y : 4, z : 2

d)

x : 5, y : 4, z : 5

30.
a)

Case-2

b)

Message

c)

Case-2 Case-3 Exit from switch

d)

Message Case-2

e)

Message Case-2 Case-3 Exit from switch

31.

a)

Choice is 1

b)

default statement

c)

compile time error

d)

Choice is 1default statement

32.
a)

-1 1

b)

1 -1

c)

-1 -1

d)

1 1

33.
a)

14

b)

11

c)

12

d)

13

34.
a)

10 5 3 4

b)

10 5 4 4

c)

10 5 3 3

d)

10 5 4 3

35.

Find The Output

int a = 3;

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

(a)  

36.

int a = 10;

int b = a++ + ++a;

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

(a)  

37.

int a = 3;

printf("%d %d %d %d",++a , a++ ,a, --a);

(a)  

38.



(a)  

39.
a)

14 8

b)

3 8

c)

3 7

d)

4 8

40.
a)

50 10 24 50

b)

50 13 24 50

c)

50 13 24 13

d)

50 13 11 13

41.



(a)  

42.



(a)  

43.



(a)  

44.

a)

44

b)

55

c)

1510

d)

error

45.
a)

4

b)

40

c)

1

d)

10

46.
a)

20

b)

10

c)

9

d)

1

47.
a)

Hello

b)

World

c)

1

d)

0

48.
a)

4 4

b)

4 1

c)

1 4

d)

1 1

49.



(a)  

50.
a)

-65535 -65535

b)

65535 -65536

c)

-65535 65535

d)

65535 65535