CSE MCQs :: C-MCQs
-
What is the output of this C code?
int main()
{
int x = 1;
int y = x == 1 ? getchar(): 2;
printf("%d\n", y);
} -
What is the output of this C code?
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");
} -
What is the output of this C code?
int main()
{
int a = 2;
int b = 0;
int y = (b == 0) ? a :(a > b) ? (b = 1): a;
printf("%d\n", y);
} -
What is the output of this C code?
int main()
{
int y = 1, x = 0;
int l = (y++, x++) ? y : x;
printf("%d\n", l);
} -
What is the output of this C code?
void main()
{
int k = 8;
int m = 7;
int z = k < m ? k++ : m++;
printf("%d", z);
} -
Comment on the output of this C code?
void main()
{
int k = 8;
int m = 7;
int z = k < m ? k = m : m++;
printf("%d", z);
} -
The code snippet below produces
void main()
{
1 < 2 ? return 1 : return 2;
} -
The output of the code below is
void main()
{
int k = 8;
int m = 7;
k < m ? k++ : m = k;
printf("%d", k);
} -
The output of the code below is
void main()
{
int k = 8;
int m = 7;
k < m ? k = k + 1 : m = m + 1;
printf("%d", k);
} - For initialization a = 2, c = 1 the value of a and c after this code will be c = (c) ? a = 0 : 2;