wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Operators

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}

return 0;

}

a)

25 25 25

b)

25 26 27

c)

27 27 27

d)

Compiler error

2.

What is the output of C Program.?

int main()

{

int a=32;

do

{

printf("%d ", a);

a++;

}

while(a <= 30);

return 0;

}

a)

32

b)

33

c)

30

d)

No Output

3.

What is the output of C Program.?

int main()

{

int a=32;

do

{

printf("%d ", a);

a++;

if(a > 35)

break;

}

while(1);

return 0;

}

a)

No Output

b)

32 33 34

c)

32 33 34 35

d)

Compiler error

4.

Choose a correct C Statement.

a)

a++ is (a=a+1) POST INCREMENT Operator

b)

a-- is (a=a-1) POST DECREMENT Operator

--a is (a=a-1) PRE DECREMENT Operator

c)

++a is (a=a+1) PRE INCREMENT Operator

d)

All the above.

5.

Loops in C Language are implemented using.?

a)

While Block

b)

For Block

c)

Do While Block

d)

All the above

6.

Choose a correct C do while syntax.

a)

dowhile(condition) { //statements }

b)

do while(condition) { //statements }

c)

do { //statements }while(condition)

d)

do { //statements }while(condition);

7.

int main ()

{

int x = 24, y = 39, z = 45;

z = x + y;

y = z - y;

x = z - y;

printf ("%d %d %d", x, y, z);

}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

8.

int main()


{


int a = 10, b = 25;


a = b++ + a++;


b = ++b + ++a;


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


}

a)

36 64

b)

35 62

c)

36 63

d)

30 28

9.

int main ()


{


int x = 24, y = 39, z = 45;


z = x + y;


y = z - y;


x = z - y;


printf ("n%d %d %d", x, y, z);


}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

10.

All keywords in C are in ____________

a)

Lowercase

b)

Uppercase

c)

Camelcase

d)

None of these

11.

int y = 15, b;

b = y++;

cout << "\nb = " << b;

cout << "\ny = " << y;

What will be the value of b and y?

a)

16,16

b)

15,15

c)

15,16

d)

16,15

12.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}


return 0;

}

a)

25 25 25

b)

Compiler error

c)

25 26 27

d)

27 27 27

13.

'x--' is which type of operator?

a)

post decrement

b)

pre increment

c)

post increment

d)

pre decrement

14.

What is the output of C Program with switch statement.?


int main()

{

int a=3;

switch(a)

{

case 1: printf("Hello"); break;

case 2: printf("Zero "); break;

case 3: printf("You are right");break;

case default: printf("Rabbit ");

}

}

a)

Rabbit

b)

Zero

c)

Hello

d)

You are right

15.

What is output of the program?


int main()

{

int i,j,count;

count=0;

for(i=0; i<5; i++)

{

for(j=0;j<5;j++)

{

count++;

}

}

printf("%d",count);

return 0;

}

a)

5

b)

20

c)

25

d)

10

16.

Find The Output

int a = 3;

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

(a)  

17.

int main() {


int m = -10, n = 20;


n = (m < 0) ? 0 : 1;


printf("%d %d", m, n);


}

a)

-10 0

b)

10 20

c)

20 -10

d)

0 1

18.

int x;

int y;

int z;

x=3;

y=4;

z = ++x * y++;

printf("%d",z);

a)

12

b)

16

c)

20

d)

0

19.

#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

20.

int x;

int y;

int z;

x=3;

y=4;

z = ++x * y++;

printf("%d",z);

a)

12

b)

16

c)

20

d)

0