Java Review Questions Chapter 5
What is the output of this code? t = 10 if(t > 7) System.out.print("AAA"); System.out.print("BBB");
AAA
What is the output of this code? t = 10 if(t > 7) { System.out.print("AAA"); System.out.print("BBB"); }
AAABBB
What is the output of this code? t = 7 if(t > 7) System.out.print("AAA"); System.out.print("BBB");
BBB
A decision is based on a
Boolean value
What shape is typically used in a flowchart to indicate a decision?
diamond
In Java, the value of (4 > 7) is
false
Assuming the variable q has been assigned the value 3, what statement prints XXX
if(q > 0) System.out.println("XXX");
The logical structure in which one instruction occurs after another with no branching is a
sequence
What are the types of if statements
single-alternative if dual-alternative if nested if