Quiz 2 (Prelim) Flashcards
The logical structure in which one instruction occurs after another with no branching is a ______
sequence
selection
loop
case
sequence
is typically used in a flowchart to indicate a decision
square
rectangle
diamond
oval
diamond
is not a type of if statement
single-alternative
double-alternative
reverse
nested
reverse
a decision based on a (n) _______ value
convoluted
absolute
definitive
boolean
boolean
In java the value of (14 > 7) is
true
false
4
7
true
Assuming the variable score has been assigned the value 13, which of the following statements displays XXX?
if (score > 0)
System.out.println(“XXX”);
if (score > 17);
System.out.println(“XXX”);
if (score < 7);
System.out.println(“XXX”);
All of the above
All of the above
What is the output of the ff code segment?
t = 10;
if (t > 7)
{
…..System.out.print(“AAA”);
…..System.out.print(“BBB”);
}
AAA
BBB
AAABBB
nothing
AAABBB
What is the output of the ff code segment?
t = 0;
if (t > 7)
…..System.out.print(“AAA”);
…..System.out.print(“BBB”);
AAA
BBB
AAABBB
nothing
nothing
What is the output of the ff code segment?
t = 7;
if (t > 7)
{
…..System.out.print(“AAA”);
…..System.out.print(“BBB”);
}
AAA
BBB
AAABBB
nothing
nothing
When you code an if statement within another if statement, the statements are _____
notched
nestled
nested
sheltered
nested
The operator that combines two conditions into a single Boolean value that is true when at least one of the conditions is true is _____
$$
!!
||
&&
||
Assuming a variable f has been initialized to 5, which of the following statements sets g to 0?
if (f > 6 || f == 5) g = 0;
if (f < 3 || f > 4) g = 0;
if (f >= 0 || f < 2) g = 0;
all of the above
all of the above
<
which of the ff has the lowest precedence?
&&
||
&&
||
You can use the ______ statement to terminate a switch statement
switch
end
case
break
break
cannot be the argument tested in a switch statement?
int
char
double
String
double