Which of the following expressions evaluates to true ?
Select the two correct answers.
(false true)
(null != null)
(4 <= 4)
(!true)
(true & false)
3.16
Which statements are true?
Select the two correct answers.
The remainder operator % can only be used with integral operands.
Identifiers in Java are case insensitive.
The arithmetic operators * , / , and % have the same level of precedence.
A short value ranges from -128 to +127 inclusive.
(+15) is a legal expression.
3.17
Which statements are true about the lines of output printed by the following program?
public class BoolOp { static void op(boolean a, boolean b) { boolean c = a != b; boolean d = a ^ b; boolean e = c == d; System.out.println(e); } public static void main(String[] args) { op(false, false); op(true, false); op(false, true); op(true, true); } }
Select the three correct answers.
All lines printed are the same.
At least one line contains false .
At least one line contains true .
The first line contains false .
The last line contains true .
3.18
What happens during execution of the following program?
public class OperandOrder { public static void main(String[] args) { int i = 0; int[] a = {3,6}; a[i] = i = 9; System.out.println(i + " " + a[0] + " " + a[1]); } }
Select the one correct answer.
Throws an exception of type ArrayIndexOutOfBoundsException
Prints "9 9 6"
Prints "9 0 6"
Prints "9 3 6"
Prints "9 3 9"
3.19
Which statements are true about the output of the following program?
public class Logic { public static void main(String[] args) { int i = 0; int j = 0; boolean t = true; boolean r; r = (t & 0<(i+=1)); r = (t && 0<(i+=2)); r = (t 0<(j+=1)); r = (t 0<(j+=2)); System.out.println(i + " " + j); } }