menu

Java Operators

Java Operators - Important Points


31. What is the result of the expression 4 % 2?

A. 0

B. 1

C. 2

D. 4

Discuss Work Space

Answer: option a

Explanation:

The % operator is used for modulo division, which gives the remainder after division. In this case, 4 divided by 2 leaves a remainder of 0.

32. Which of the following operators is used to compare two values for greater than?

A. !=

B. ==

C. >=

D. >

Discuss Work Space

Answer: option d

Explanation:

The > operator is used to test if the left operand is greater than the right operand.

33. What is the result of the expression 2 + 2 * 3?

A. 6

B. 8

C. 10

D. 8

Discuss Work Space

Answer: option d

Explanation:

In Java, multiplication and division have higher precedence than addition and subtraction. Therefore, 2 * 3 is evaluated first, resulting in 6. Then, 2 is added to 6 to get the final result of 8.

34. Which of the following operators is used to perform a bitwise right shift operation?

A. <<

B. >>

C. &

D. |

Discuss Work Space

Answer: option b

Explanation:

The >> operator is used to perform a bitwise right shift operation in Java.

35. What is the result of the expression true && false?

A. 1

B. 0

C. 1

D. 0

Discuss Work Space

Answer: option b

Explanation:

The && operator is the logical AND operator. Both operands must be true for the result to be true.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now