Topic Two Flashcards
A ________ structure can execute a set of statements only under certain circumstances.
a. sequence
b. circumstantial
c. decision
d. Boolean
c. decision
A ___________ structure provides one alternative path of execution.
a. sequence
b. single alternative decision
c. one path alternative
d. single execution decision
b. single alternative decision
A (n) __________ expression has a value of either True or False.
a. binary
b. decision
c. unconditional
d. Boolean
d. Boolean
The symbols >, < , == and are all _________ operators.
a. relational
b. logical
c. conditional
d. ternary
a. relational
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
c. 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
b. if
You use a (n) _________ statement to write a dual alternative decision structure.
a. test-jump
b. if
c. if-else
d. if-call
c. if-else
and , or , not are _________ operators.
a. relational
b. logical
c. conditional
d. ternary
b. logical
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. and
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
b. or
The _______ operator takes a Boolean expression as its operand and reverses its logical value.
a. and
b. or
c. not
d. either
c. not
A ______ is a Boolean variable that signals when some condition exists in the program.
a. flag
b. signal
c. sentinel
d. siren
a. flag
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
True or False
A single alternative decision structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.
True
True or False
A decision structure can be nested inside another decision structure.
True
True or False
A compound Boolean expression created with the and operator is true only when both subexpressions are true.
True
A (n) __________ structure is a logical design that controls the order in which a set of statements execute
a. Control
b. Sequence
c. Function
d. Iteration
a. Control
Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions
a. Sequential
b. Mathematical
c. Logical
d. Compound
d. Compound
Which logical operators perform short-circuit evaluation?
a. not, and
b. or, and
c. or, not
d. and, or, not
b. or, and
Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?
a. if y >= 10 and y <= 50:
b. if 10 > y and y < 50:
c. if 10 < y or y > 50:
d. if y >= 10 or y <= 50:
a. if y >= 10 and y <= 50:
What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y or z > x
a. False
b. 8
c. True
d. 5
c. True
Which of the following is the correct if clause to determine whether choice is a number other than 10?
a. if choice == 10:
b. if choice < 10 or choice > 10:
c. if choice <> 10:
d. if choice != 10
b. if choice < 10 or choice > 10:
In Python the __________ symbol is used as the not-equal-to operator
a. <>
b. <=
c. !=
d. ==
c. !=