Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Quiz

Total questions: 18

Worksheet time: 9mins

Name
Class
Date
1.

What will be the output of the following 'C' code? void main ( ) { int x = 128; printf ("\n%d", 1 + x ++); }

a)

128

b)

129

2.

What will be the output of the following 'C' code? #include void main() { int a=30,b=40,x; x=(a!=10) && (b=50); printf("%d",x); }

a)

0

b)

1

3.

What will be the output of the following 'C' code? #include int main() { int x= -7 - -9; int y= -7 - -(-9); printf("x=%d\ny=%d\n",x,y); return 0; }

a)

x=2 y=-16

b)

x=-2 y=16

4.

What will be the output of the following 'C' code? #include int main() { int x; x= 9 % 5 * 4; printf("x=%d",x); return 0; }

a)

x=16

b)

x=4

5.

What will be the output of the following 'C' code? #include int main() { int x; x= 4 - 6 * 5/5 + 7 % 2;; printf("x= %d",x); return 0; }

a)

x=-1

b)

x=1

6.

What will be the output of the following 'C' code? #include int main() { int a; float b ; a=9 % 4; b= 9 % 4; printf("%d, %f \n",a,b); return 0; }

a)

1, 1.000000

b)

0, 0.000000

7.

What will be the output of the following 'C' code? #include int main() { int a; a=5^ 8-3*2; printf("%d",a); return 0; }

a)

7

b)

1

8.

What will be the output of the following 'C' code? #include int main() { int x=10,y=-20; x=!x; y=!y; printf("x= %d, y= %d", x,y); return 0; }

a)

x= 0, y= 0

b)

x= 1, y= 1

9.

What will be the output of the following 'C' code? #include int main() { int x=3,y=4,z=4; printf("ans= %d", z>=y&&y>=x?1:0); return 0; }

a)

ans= 1

b)

ans= 0

10.

What will be the output of the following 'C' code? #include int main() { int x=3,y=4,z=4; printf("ans= %d", (z>=y>=x?100:200)); return 0; }

a)

ans= 100

b)

ans= 200

11.

What will be the output of the following 'C' code? #include int main() { int a=10,b=10; printf("ans= %d",a>b?a*a:b/b); return 0; }

a)

ans= 1

b)

ans= 0

12.

What will be the output of the following 'C' code? #include int main() { int a=10,b=20,c=30; c=(10,20)==(c,b); printf("%d",c); return 0; }

a)

ans= 1

b)

ans= 0

13.

What will be the output of the following 'C' code? #include int main() { int a=10,b=20,c=30; c==a==b; printf("%d%d%d",a,b,c); return 0; }

a)

10 20 30

b)

10 20 0

14.

What will be the output of the following 'C' code? #include int main() { int k=12,n=30; k=(n=4 && n==4?100:200); printf("k= %d",n) ; return 0; }

a)

k= 200

b)

k= 100

15.

What will be the output of the following 'C' code? #include int main() { int a=10,b=20,c=30; printf("ans= %d",a>b? a>c?a:c : b>c?b:c); return 0; }

a)

ans= 30

b)

ans= 20

16.

What will be the output of the following 'C' code? #include int main() { int a=5,b=10; a+=b; printf("%d",a); return 0; }

a)

15

b)

5

17.

What will be the output of the following 'C' code? #include int main() { int x=2,y=3; printf("%d",x*y++); return 0; }

a)

9

b)

6

18.

What will be the output of the following 'C' code? #include int main() { int a=1,b=2,c=3; printf("%d",a

a)

0

b)

1