What is the output of: int a = 10, b = 3; System.out.println(a > b && a % b == 1);
Operators and Expressions in Java
Original Khojo Papers practice question — not from a past board paper.
With && the second operand is not evaluated at all if the first is false, and with || it is not evaluated if the first is true. It is used to guard against errors, as in "if (n != 0 && total / n > 5)", where the division is never attempted when n is zero.
No citable source has been recorded for this record. Treat it as practice material, not as fact.
The single-character & and | do not short-circuit.
From the same topic and chapter, at a similar level.
What is the output of: int a = 10, b = 3; System.out.println(a > b && a % b == 1);
Operators and Expressions in Java
Explain the ternary operator in Java and rewrite "if (a > b) max = a; else max = b;" using it.
Operators and Expressions in Java
Evaluate the expression 10 + 5 * 2 - 8 / 4 in Java and explain the order of evaluation.
Operators and Expressions in Java
What is the output of: int x = 5; System.out.println(x++ + ++x);
Operators and Expressions in Java
What is the output of: String s = "Examination"; System.out.println(s.length() + " " + s.substring(0, 4) + " " + s.toUpperCase().charAt(2));
String Handling
Reduce the Boolean expression X·Y + X·Y′ using the laws of Boolean algebra.
Boolean Algebra