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.
The ternary operator has the form condition ? valueIfTrue : valueIfFalse and returns one of two values according to the condition. The statement becomes "max = (a > b) ? a : b;".
No citable source has been recorded for this record. Treat it as practice material, not as fact.
It is an expression, not a statement, so it can be used wherever a value is expected.
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
What is short-circuit evaluation, and give one practical use of 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
Distinguish between the canonical SOP and POS forms of a Boolean expression.
Boolean Algebra
What is the output of: String s = "Examination"; System.out.println(s.length() + " " + s.substring(0, 4) + " " + s.toUpperCase().charAt(2));
String Handling