C
Programming and Technical
Programming
Program
What will be the output of the program?
#include
int main()
{
int x=12, y=7, z;
z = x!=4 || y == 2;
printf("z=%dn", z);
return 0;
}
Options
1) z=0
2) z=1
3) z=4
4) z=2
Read Solution (Total 1)
-
- z=1n firstly z!=4 is evaluated it give 1,then y==2 it gives 0
1||0 gives 1 but in the printf %DN has written so ans will be 1n - 9 years agoHelpfull: Yes(3) No(0)
C Other Question
What will be the output of the program?
#include
int main()
{
static int a[20];
int i = 0;
a[i] = i ;
printf("%d, %d, %dn", a[0], a[1], i);
return 0;
}
Options
1) 1, 0, 1
2) 1, 1, 1
3) 0, 0, 0
4) 0, 1, 0
Assunming, integer is 2 byte, What will be the output of the program?
#include
int main()
{
printf("%xn", -2<<2);
return 0;
}
Options
1) ffff
2) 0
3) fff8
4) Error