Java - MCQ
Multiple Choice Questions
Java - Multiple Choice Questions (MCQ) - Introduction to Java - Set 7
31. Which of these have highest precedence?
A). ()
B). *
C). >>
D). ++
View Answer
Correct: A
32. What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
A). Floating – point numbers
B). Integer
C). Boolean
D). None of the mentioned
View Answer
Correct: C
33. What is the value stored in x in the following lines of Java code?
int x, y, z;
x = 0;
y = 1;
x = y = z = 8;
A). 1
B). 9
C). 0
D). 8
View Answer
Correct: D
34. What is the order of precedence (highest to lowest) of following operators?
1. &
2. ^
3. ?:
A). 1 -> 2 -> 3
B). 2 -> 1 -> 3
C). 3 -> 2 -> 1
D). 2 -> 3 -> 1
View Answer
Correct: A
35. Which of these statements are incorrect?
A). Equal to operator has least precedence
B). Addition operator and subtraction operator have equal precedence
C). Division operator has higher precedence than multiplication operator
D). Brackets () have highest precedence
View Answer
Correct: C