Java Operators
Java Operators - Important Points
6. | Which of the following is the correct operator for multiplication? |
---|
A. +
B. -
C. *
D. /
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The * operator is used for multiplication in Java. The + operator is used for addition.
7. | What is the result of the expression 5 > 3 && 4 < 6? |
---|
A. 1
B. 0
C. 1
D. 0
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The && operator is the logical AND operator. Both operands must be true for the result to be true.
8. | Which of the following is the correct operator for subtraction? |
---|
A. +
B. -
C. *
D. /
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The - operator is used for subtraction in Java. The + operator is used for addition.
9. | What is the result of the expression 5 / 2? |
---|
A. 2.5
B. 2
C. 3
D. 2
View Answer Discuss Work SpaceAnswer: option b
Explanation:
Integer division truncates the result, so 5 / 2 gives a result of 2.
10. | Which of the following operators is used to concatenate two strings? |
---|
A. +
B. -
C. *
D. /
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The + operator is used to concatenate two strings in Java.