Quiz 2 (Prelim) Flashcards

1
Q

The logical structure in which one instruction occurs after another with no branching is a ______

sequence
selection
loop
case

A

sequence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

is typically used in a flowchart to indicate a decision

square
rectangle
diamond
oval

A

diamond

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

is not a type of if statement

single-alternative
double-alternative
reverse
nested

A

reverse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

a decision based on a (n) _______ value

convoluted
absolute
definitive
boolean

A

boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In java the value of (14 > 7) is

true
false
4
7

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

AAABBB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When you code an if statement within another if statement, the statements are _____

notched
nestled
nested
sheltered

A

nested

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The operator that combines two conditions into a single Boolean value that is true when at least one of the conditions is true is _____

$$
!!
||
&&

A

||

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

all of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

<

which of the ff has the lowest precedence?

&&
||

A

&&
||

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You can use the ______ statement to terminate a switch statement

switch
end
case
break

A

break

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

cannot be the argument tested in a switch statement?

int
char
double
String

A

double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Assuming a variable w has been assigned the value 15, what does the ff statement do?
w == 15 ? x = 2 : x = 0;

assigns 15 to w
assigns 2 to x
assigns 0 to x
nothing

A

assigns 2 to x

17
Q

Assuming a variable y has been assigned the value 6, the value of ! (y < 7) is _______

6
7
true
false

A

false