3.2 Assume that x is 1, show the result of the following Boolean expressions:
(true) && (3 > 4) (answer: FALSE)
!(x > 0) && (x > 0)
(x > 0) || (x < 0)
(x != 0) || (x == 0)
(x >= 0) || (x < 0)
(x != 1) == !(x == 1)
3.10 Suppose x = 3 and y = 2, show the output, if any, of the following code.
What is the output if x = 3 and y = 4?
What is the output if x = 2 and y = 2?
Draw a flowchart of the following code:
if (x > 2) {
if (y > 2) {
int z = x + y;
System.out.println("z is " + z);
}
}
else
System.out.println("x is " + x);
Due Date: 12 sept 2011 before 4:00 pm (by email (nazri.ibrahim@gmail.com) or hard copy)
No comments:
Post a Comment