Operators and Expression

Operators and Expression

Arithmetic Operators, Relational and Logical Operators, Bitwise Operators, Increment and Decrement Operators, Conditional (Ternary) Operator, Compound Expressions

1 / 10

What is the output of the following code?

int a = 10, b = 3;
System.out.println(a / b);

2 / 10

What will this expression evaluate to?

int result = 10 + 20 * 3 / 2 – 5;
System.out.println(result);

3 / 10

What will the following code output?

int a = 5, b = 10;
System.out.println(a > 3 && b < 15);

4 / 10

What is the output of this code?

int x = 10;
System.out.println(x > 5 || x++ < 20); System.out.println(x);

5 / 10

What will the following code output?

int a = 5, b = 3;
System.out.println(a & b);

6 / 10

What is the result of the expression 8 >> 2?

7 / 10

What will the following code print?

int x = 10;
System.out.println(x++ + ++x);

8 / 10

What will be the value of x after the following code is executed?

int x = 5;
x += x++ + ++x;

9 / 10

What is the output of the following code?

int a = 10, b = 20;
int result = (a > b) ? a : b;
System.out.println(result);

10 / 10

What will the following code print?

int a = 5;
int b = 10;
int c = 15;
int result = a * b + c / b – a;
System.out.println(result);

Your score is

Scroll to Top