#include int main() { int x = 2, y = 0; int z = (y++) ? y == 1 && x : 0; printf("%d\n", z); return 0; }
0
1
Undefined behaviour
Compile time error
What will be the output of the following C code?
#include int main() { int x = 1; int y = x == 1 ? getchar(): 2; printf("%d\n", y); }
Compile time error
Whatever character getchar function returns
Ascii value of character getchar function returns
2
What will be the output of the following C code?
#include int main() { int x = 1; short int i = 2; float f = 3; if (sizeof((x == 2) ? f : i) == sizeof(float)) printf("float\n"); else if (sizeof((x == 2) ? f : i) == sizeof(short int)) printf("short int\n"); }
float
short int
Undefined behaviour
Compile time error
What will be the output of the following C code? #include int main() { int a = 2; int b = 0; int y = (b == 0) ? a :(a > b) ? (b = 1): a; printf("%d\n", y); }
Compile time error
1
2
Undefined behaviour
What will be the output of the following C code?
#include int main() { int y = 1, x = 0; int l = (y++, x++) ? y : x; printf("%d\n", l); }
1
2
Compile time error
Undefined behaviour
What will be the output of the following C code?
#include void main() { int k = 8; int m = 7; int z = k < m ? k++ : m++; printf("%d", z); }
7
8
Run time error
15
What will be the output of the following C code?
#include void main() { int k = 8; int m = 7; int z = k < m ? k = m : m++; printf("%d", z); }