Deck 4: Decision Structures and Boolean Logic
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/35
Play
Full screen (f)
Deck 4: Decision Structures and Boolean Logic
1
A Boolean variable can reference one of two values: _____.
A) yes or no
B) t or false
C) T or f
D) Y or N
A) yes or no
B) t or false
C) T or f
D) Y or N
B
2
Nested decision structures are one way to test more than one condition.
True
3
In Python the _____ symbol is used as the equality operator.
A) ==
B) =
C) >=
D) <=
A) ==
B) =
C) >=
D) <=
A
t/false
t/false
4
Python uses the same symbols for the assignment operator and the equality operator.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
5
The decision structure that has two possible paths of execution is known as _____.
A) single alternative
B) double alternative
C) dual alternative
D) two alternative
A) single alternative
B) double alternative
C) dual alternative
D) two alternative
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
6
The if statement causes one or more statements to execute only when a Boolean expression ist.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is the correct if clause to determine whether y is in the range 10 through 50?
A) if 10 < y or y > 50
B) if 10 > y and y < 50
C) if y > 10 and y < 50
D) if y > 10 or y < 50
A) if 10 < y or y > 50
B) if 10 > y and y < 50
C) if y > 10 and y < 50
D) if y > 10 or y < 50
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
8
In Python, the _____ symbol is used as the not-equal-to operator.
A) ==
B) <>
C) <=
D) !=
A) ==
B) <>
C) <=
D) !=
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
9
Python allows you to compare strings, but it is not case sensitive.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
10
When using the _____ operator, one or both subexpressions must bet for the compound expression to bet.
A) Or
B) And
C) Not
D) Maybe
A) Or
B) And
C) Not
D) Maybe
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
11
A(n) _____ structure is a logical design that controls the order in which a set of statements execute.
A) function
B) control
C) sequence
D) iteration
A) function
B) control
C) sequence
D) iteration
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following is the correct if clause to use to determine whether choice is other than 10?
A) if choice != 10:
B) if choice != 10
C) if choice <> 10:
D) if choice <> 10
A) if choice != 10:
B) if choice != 10
C) if choice <> 10:
D) if choice <> 10
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
13
What is the result of the following Boolean expression, if x equals 5, y equals 3, and z equals 8? not (x < y or z > x) and y < z
A) t
B) false
C) 8
D) 5
A) t
B) false
C) 8
D) 5
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
14
When using the _____ operator, both subexpressions must bet for the compound expression to bet.
A) or
B) and
C) not
D) maybe
A) or
B) and
C) not
D) maybe
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
15
What is the result of the following Boolean expression, if x equals 5, y equals 3, and z equals 8? x < y and z > x
A) t
B) false
C) 8
D) 5
A) t
B) false
C) 8
D) 5
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
16
What is the result of the following Boolean expression, if x equals 5, y equals 3, and z equals 8? x < y or z > x
A) t
B) false
C) 8
D) 5
A) t
B) false
C) 8
D) 5
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
17
t/false: The Python language is not sensitive to block structuring of code.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
18
Multiple Boolean expressions can be combined by using a logical operator to create _____ expressions.
A) sequential
B) logical
C) compound
D) mathematical
A) sequential
B) logical
C) compound
D) mathematical
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
19
What does the following expression mean? x <= y
A) x is less than y
B) x is less than or equal to y
C) x is greater than y
D) x is greater than or equal to y
A) x is less than y
B) x is less than or equal to y
C) x is greater than y
D) x is greater than or equal to y
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
20
Which logical operators perform short-circuit evaluation?
A) or, not
B) not, and
C) or, and
D) and, or, not
A) or, not
B) not, and
C) or, and
D) and, or, not
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
21
In flowcharting, the _______________ symbol is used to represent a Boolean expression.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) _______________ expression is made up of two or more Boolean expressions.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
23
In a decision structure, the action is _______________ executed because it is performed only when a certain condition ist.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
24
Short-circuit evaluation is performed with the not operator.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
25
An action in a single alternative decision structure is performed only when the condition ist.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
26
Boolean variables are commonly used as _______________ to indicate whether a specific condition exists.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
27
The logical _______________ operator reverses the truth of a Boolean expression.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
28
Python provides a special version of a decision structure known as the _______________ statement, which makes the logic of the nested decision structure simpler to write.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
29
Decision structures are also known as selection structures.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
30
The _______________ statement is used to create a decision structure.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
31
Expressions that are tested by the if statement are called Boolean expressions.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
32
A(n) _______________ decision structure provides only one alternative path of execution.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
33
The not operator is a unary operator and it must be a compound expression.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) _______________ statement will execute one block of statements if its condition ist, or another block if its condition is false.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
35
A(n) _______________ operator determines whether a specific relationship exists between two values.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck