Chapter 3 Multiple choice questions Flashcards

1
Q

A ______ structure can execute a set of statements only under certain circumstances.

a) sequence
b) circumstantial
c) decision
d) Boolean

A

A decision structure.

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

A ______ structure provides one alternative path of execution.

a) sequence
b) single alternative decision
c) one path alternative
d) single execution decision

A

A single alternative decision structure. If the condition is true, the program takes the alternative path.

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

A(n) ______ expression has a value of either True or False.

a) binary
b) decision
c) unconditional
d) Boolean

A

A Boolean expression has a value of either True or False.

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

The symbols >,

A

> ,

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

A(n) ______ structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

a) if statement
b) single alternative decision
c) dual alternative decision
d) sequence

A

A dual alternative decision.

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

You use a(n) ______ statement to write a single alternative decision structure.

a) test-jump
b) if
c) if-else
d) if-call

A

If

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

You use a(n) ______ statement to write a dual alternative decision structure.

a) test-jump
b) if
c) if-else
d) if-call

A

if-else

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

“and”, “or”, and “not” are ______ operators.

a) relational
b) logical
c) conditional
d) ternary

A

“and”, “or”, and “not” are logical operators.

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

A compound Boolean expression created with the ______ operator is true only if both of its subexpressions are true.

a) and
b) or
c) not
d) both

A

An “and” operator. [this] and [that] is true.

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

A compound Boolean expression created with the ______ operator is true if either of its subexpressions is true.

a) and
b) or
c) not
d) either

A

An “or” operator. [this] or [that] is true.

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

The ______ operator takes a Boolean expression as its operand and reverses its logical value.

a) and
b) or
c) not
d) either

A

The “not” operator.

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

A ______ is a Boolean variable that signals when some condition exists in the program.

a) flag
b) signal
c) sentinel
d) siren

A

A flag is a Boolean variable that signals when some condition exists in the program.

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

True or False:

You can write any program using only sequence structures.

A

False.

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

True or False:

A program can be made of only one type of control structure. You cannot combine structures.

A

False. Control structures can be combined (for example if-else with for-loop inside).

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

True or False:

A decision structure can be nested inside another decision structure.

A

True. Think if-elif-elif-elif.

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

True or False:

A compound Boolean expression created with the “and” operator is true only when both subexpressions are true.

A

True.