github

Made bySaurav Hathi

MCQ Test C/C++: Operators

Q1:

What is the output of this C code?

#include <stdio.h>

int main()

{

int x = 1, y = 0, z = 5;

int a = x && y || z++;

printf("%d", z);

}

Tags:
Section:
Core Programming
Options:
Q2:

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int x = 1, y = 0, z = 5;

int a = x && y && z++;

printf("%d", z);

}

Tags:
Section:
Core Programming
Options:
Q3:

What is the output of this C code?

#include <stdio.h>

int main()

{

int x = 1, y = 0, z = 3;

x > y ? printf("%d", z) : return z;

}

Tags:
Section:
Core Programming
Options:
Q4:

Does logical operators in C language are evaluated with short circuit?

Tags:
Section:
Core Programming
Options:
Q5:

What is the output of this C code?

#include <stdio.h>

int main()

{

int a = 1, b = 1, d = 1;

printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);

}

Tags:
Section:
Core Programming
Options:
Q6:

What is the output of this C code?

#include <stdio.h>

int main()

{

int a = 5, b = -7, c = 0, d;

d = ++a && ++b || ++c;

printf("%d %d %d %d", a,  b, c, d);

}

Tags:
Section:
Core Programming
Options:
Q7:

1.     What is the output of this C code?

#include <stdio.h>

int main()

{

int k = 8;

int x = 0 == 1 && k++;

printf("%d %d\n", x, k);

}

Tags:
Section:
Core Programming
Options:
Q8:

What is the output of this C code?

#include <stdio.h>

int main()

{

int x = 2, y = 0;

int z = y && (y |= 10);

printf("%d\n", z);

return 0;

}

Tags:
Section:
Core Programming
Options:
Q9:

What is the output of this C code?

#include <stdio.h>

int main()

{

int y = 2;

int z = y +(y = 10);

printf("%d\n", z);

}

Tags:
Section:
Core Programming
Options:
Q10:

What is the output of this C code?

#include <stdio.h>

int main()

{

double b = 3 && 5 & 4 % 3;

printf("%lf", b);

}

Tags:
Section:
Core Programming
Options: