menu

Java Operators

Java Operators - Important Points


16. Which of the following operators is used to decrement a variable by 1?

A. +=

B. ++

C. --

D. *

Discuss Work Space

Answer: option c

Explanation:

The -- operator is used to decrement a variable by 1. For example, i-- is equivalent to i = i - 1.

17. What is the result of the expression 5 >= 5?

A. 1

B. 0

C. 1

D. 0

Discuss Work Space

Answer: option a

Explanation:

The >= operator is used to test if the left operand is greater than or equal to the right operand. In this case, both operands are equal, so the result is true.

18. Which of the following is the correct operator for modulo division?

A. %

B. /

C. //

D. *

Discuss Work Space

Answer: option a

Explanation:

The % operator is used for modulo division, which gives the remainder after division.

19. What is the result of the expression (10 > 5) || (3 < 1)?

A. 1

B. 0

C. 1

D. 0

Discuss Work Space

Answer: option a

Explanation:

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

20. Which of the following operators is used to test if a variable refers to the same object as another variable?

A. !=

B. ==

C. <=

D. >=

Discuss Work Space

Answer: option b

Explanation:

The == operator is used to test if two variables refer to the same object in Java. Note that this is different from testing if two objects are equal.


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