Operators & Expressions MCQs

Topic-wise practice questions for Programming (C++ / Java / Python). Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q1easy
What does performing a Bitwise Left Shift (<<) by 2 positions do to an integer?
Q2medium
Trace this code snippet:

int x = 5;
if (x = 0) {
    print("Zero");
} else {
    print("Non-Zero");
}
In C/C++, what is the output?
Q3easy
Trace the value of val:

int val = 8;
val >>= 2;
Q4easy
Which operator has the lowest precedence in most programming languages?
Q5easy
Trace the value of x and y:

int x = 10;
int y = x++;
Q6easy
Trace the value of ans:

int ans = 10 % 3 + 4 << 1;
Q7medium
What will be printed?

int x = 10;
int y = 20;
print(x > 5 && y < 15 ? "Alpha" : "Beta");
Q8medium
A developer needs to swap two integers a and b without using a third temporary variable. Which bitwise operator can achieve this?
Q9easy
Evaluate the expression: 10 + 5 * 2 == 20
Q10easy
Trace the output:

int i = 5;
int j = ++i + i++;
print(j);