Chapter 3 Multiple choice questions Flashcards
A ______ structure can execute a set of statements only under certain circumstances.
a) sequence
b) circumstantial
c) decision
d) Boolean
A decision structure.
A ______ structure provides one alternative path of execution.
a) sequence
b) single alternative decision
c) one path alternative
d) single execution decision
A single alternative decision structure. If the condition is true, the program takes the alternative path.
A(n) ______ expression has a value of either True or False.
a) binary
b) decision
c) unconditional
d) Boolean
A Boolean expression has a value of either True or False.
The symbols >,
> ,
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 dual alternative decision.
You use a(n) ______ statement to write a single alternative decision structure.
a) test-jump
b) if
c) if-else
d) if-call
If
You use a(n) ______ statement to write a dual alternative decision structure.
a) test-jump
b) if
c) if-else
d) if-call
if-else
“and”, “or”, and “not” are ______ operators.
a) relational
b) logical
c) conditional
d) ternary
“and”, “or”, and “not” are logical operators.
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
An “and” operator. [this] and [that] is true.
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
An “or” operator. [this] or [that] is true.
The ______ operator takes a Boolean expression as its operand and reverses its logical value.
a) and
b) or
c) not
d) either
The “not” operator.
A ______ is a Boolean variable that signals when some condition exists in the program.
a) flag
b) signal
c) sentinel
d) siren
A flag is a Boolean variable that signals when some condition exists in the program.
True or False:
You can write any program using only sequence structures.
False.
True or False:
A program can be made of only one type of control structure. You cannot combine structures.
False. Control structures can be combined (for example if-else with for-loop inside).
True or False:
A decision structure can be nested inside another decision structure.
True. Think if-elif-elif-elif.
True or False:
A compound Boolean expression created with the “and” operator is true only when both subexpressions are true.
True.