Loading

Q1.

What is the output of the following code?

int x = 5;

System.out.println(x++ + ++x);

A. 10
B. 11
C. 12
D. 13

Q2.

Which operator is used to compare two values in Java?

A. =
B. ==
C. !=
D. equals()

Q3.

 What will be the output of the following expression?


int a = 10, b = 20, c = 30;

System.out.println(a < b && b < c);

A. true
B. false
C. 1
D. 0

Q4.

What does the % operator do in Java?

A. Divides two numbers

B. Finds remainder

C. Increments value

D. Converts to percentage

Q5.

 What is the output of this expression?

int a = 5, b = 10;

System.out.println(a > b ? a : b);

A. 5
B. 10
C. true
D. false