menu

Java Operators

Java Operators - Important Points


36. Which of the following operators is used to compare two values for not equal to?

A. !=

B. ==

C. >=

D. <=

Discuss Work Space

Answer: option a

Explanation:

The != operator is used to test if the two operands are not equal.

37. What is the result of the expression 1 + 2 + "3"?

A. 33

B. 6

C. 123

D. 6

Discuss Work Space

Answer: option a

Explanation:

In Java, when a string is concatenated with a number, the number is first converted to a string. Therefore, 1 + 2 is evaluated first, resulting in 3. Then, "3" is concatenated with 3 to get the final result of "33".

38. Which of the following operators is used to perform a logical OR operation?

A. &

B. &&

C. |

D. ||

Discuss Work Space

Answer: option d

Explanation:

The || operator is the logical OR operator. If either of the operands is true, the result is true.

39. What is the result of the expression 3 * 2 / 4?

A. 0.75

B. 1.5

C. 3

D. 6

Discuss Work Space

Answer: option b

Explanation:

In Java, multiplication and division have the same precedence, so they are evaluated left to right. Therefore, 3 * 2 is evaluated first, resulting in 6. Then, 6 is divided by 4, resulting in 1.5.

40. Which of the following operators is used to perform a bitwise XOR operation?

A. &

B. &&

C. ^

D. ||

Discuss Work Space

Answer: option c

Explanation:

The ^ operator is used to perform a bitwise XOR operation in Java.


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