Java Operators
Java Operators - Important Points
26. | Which of the following operators is used to compare two values for less than or equal to? |
---|
A. !=
B. ==
C. >=
D. <=
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The <= operator is used to test if the left operand is less than or equal to the right operand.
27. | What is the result of the expression "Hello" + "World"? |
---|
A. Hello World
B. HelloWorld
C. Hello+World
D. HelloWorld!
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The + operator is used to concatenate strings in Java.
28. | Which of the following operators is used to perform a bitwise OR operation? |
---|
A. &
B. &&
C. |
D. ||
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The | operator is used to perform a bitwise OR operation in Java.
29. | What is the result of the expression 5 / 2? |
---|
A. 2.5
B. 2
C. 2
D. 3
View Answer Discuss Work SpaceAnswer: option b
Explanation:
When both operands of the / operator are integers, the division is performed as integer division, resulting in an integer value.
30. | Which of the following operators is used to perform a logical negation operation? |
---|
A. !
B. ~
C. +
D. -
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The ! operator is used to perform a logical negation operation in Java. It returns true if the operand is false, and false if the operand is true.