operators in c language programming to improve c skills
1. What will be the output for the following C code
1)#include <stdio.h>
int main()
{
int a;
a=015+0x71+5;
printf("%dn", a);
}
2. What will be the output for the following C code
2)#include <stdio.h>
int main()
{
printf(“%d”,4%3);
Printf(“%d”,-4%3);
Printf(“%d”,4%-3);
printf(“%d”,-4%-3);
}
3. What will be the output for the following C code
3) #include<stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = b + c == a;
printf("%d", d);
}
4. What will be the output for the following C code
4)#include <stdio.h>
int main()
{
int x=12,y=7,z;
z=x!=4||y==2;
Printf(“%d”,z);
}
5. What will be output of the following c code
5)#include<stdio.h>
Void main() {
int i=4,j=-1,k=0,w,x,y,z;
w=i||j||k;
x=i&&j&&k;
y=i||j&&k;
z=i&&j||k;
printf("n w=%d X=%d y=%d z=%d",w,x,y,z);
}
6. What will be output of the following c code
6) #include<stdio.h>
Void main()
{
Int a,b=20,c;
a=10,20,30;
c=a+b;
Printf(“%d”,c);
}
7. What will be output of the following c code
7) #include<stdio.h>
Void main()
{
Int a,b=20,c;
a=(10,20,30);
c=a+b;
Printf(“%d”,c);
}
8. What will be output of the following c code
8) #include<stdio.h>
Void main()
{
Int a=10,20,30,b=20,c;
c=a+b;
Printf(“%d”,c);
}
9. What will be the output for the following C code
9) #include <stdio.h>
int main()
{
int a = 1, b = 2;
a += b -= a;
printf("%d %d", a, b);
}
10. What will be the output for the following C code
10) #include <stdio.h>
int main()
{
int a = 1, b = 2,c=3,d=4;
a += b -= c*=d;
printf("%d %d%d%d", a, b,c,d);
}
11. What will be the output for the following C code
11) #include <stdio.h>
void main()
{
int i=-3,j=2,k=0,m;
m=++i&&++j&&++k;
printf(“%d%d%d%d”,i,j,k,m);
}
12. What will be the output for the following C code
12) #include <stdio.h>
void main()
{
int i=-3,j=2,k=0,m;
m=++i||++j||++k;
printf(“%d%d%d%d”,i,j,k,m);
}
13. What will be the output for the following C code
13) #include <stdio.h>
void main()
{
int i=-3,j=2,k=0,m;
m=++i&&++j||++k;
printf(“%d%d%d%d”,i,j,k,m);
}
14. What will be the output for the following C code
14) #include <stdio.h>
void main()
{
int a=2;
a=a++ + ~++a;
Printf(“%d”,a);
}
15. What will be output of the following c code
15)#include<stdio.h>
Int main(){
Int k,n=30;
K=(n>5?(n<=10?100:200):500);
Printf(“%d”,k);
Return 0;
}
16. What will be the output for the following C code
16) #include <stdio.h>
void main()
{
int a;
a=(1?2?3:4:5);
printf(“%d”,a);
}
17. What will be the output for the following C code
17)#include <stdio.h>
int main()
{
int a = 10;
a = ~a;
printf("%dn", a);
}
18. What will be the output for the following C code
18) #include<stdio.h>
void main()
{
int i=32, j=0x20, k, l, m;
k=i|j;
l=i&j;
m=k^l;
printf("%d, %d, %d, %d, %dn", i, j, k, l, m);
}
19. What will be the output for the following C code
19) #include<stdio.h>
void main()
{
int x = 0, y = 2, z = 3;
int a = x & y | z;
printf("%d", a);
}
20. What will be the output for the following C code
20)#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf("x is %d", x);
}