Write a Java program segment that reads three numbers and prints the largest.
Conditional Constructs
Original Khojo Papers practice question — not from a past board paper.
if (n > 0) System.out.println("Positive"); else if (n < 0) System.out.println("Negative"); else System.out.println("Zero");
No citable source has been recorded for this record. Treat it as practice material, not as fact.
The final else needs no condition, because the only remaining possibility is that n is zero.
From the same topic and chapter, at a similar level.
Write a Java program segment that reads three numbers and prints the largest.
Conditional Constructs
Write a Java program segment using a switch to print the name of the day for a number from 1 to 7.
Conditional Constructs
State three differences between the if-else construct and the switch-case construct.
Conditional Constructs
What is the output of the following, and why? int x = 2; switch (x) { case 1: System.out.print("A"); case 2: System.out.print("B"); case 3: System.out.print("C"); }
Conditional Constructs
Distinguish between the canonical SOP and POS forms of a Boolean expression.
Boolean Algebra
State and prove De Morgan's two theorems using a truth table.
Boolean Algebra