# COSC 1336 - Chapter 3 Quiz

## Unlock all answers in this set

question
Short-circuit evaluation is performed with the not operator.
False Why: ...
question
Multiple Boolean expressions can be combined by using a logical operator to create ________ expressions.
compound
question
The not operator is a unary operator and it must be a compound expression.
False Why: ...
question
Python allows you to compare strings, but it is not case sensitive.
False Why: ...
question
Which of the following is the correct if clause to determine whether y is in the range 10 through 50?
if y > 10 and y < 50
question
Python uses the same symbols for the assignment operator and the equality operator.
False Why: ...
question
The decision structure that has two possible paths of execution is known as ________.
dual alternative
question
The if statement causes one or more statements to execute only when a Boolean expression is true.
True
question
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
False Why: ... If (x=5) < (y=3), this is False. AND = the condition, both must be true. (z=8) > (x=5), this is True The whole statement is False because it uses the AND condition not the OR condition.
question
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
False Why: ... First: NOT = operator #1, this means the value of this expression must be reversed. so... Second: [ (x=5) < (y=3), expression 1 is False Third: OR = the operator #2, one of these must be true. (z=8) > (x=5) ], expression 2 is True - so far the sub-expression 1, in brackets, is True. ---> Now: you must reverse the value per first step. true value is now (-)False Fourth: AND= operator #3, both (sub-expression 1 and sub-expression 2 ) must be true. (y=3) < (z=8), sub-expression 2 is True. ---> This means that expressions 2-4, or sub-expression1 and sub-expression 2, as a whole is (+)True. Finally: Remember two (-)negatives make a (+)positive. This contains one neg., First step and one pos., expression 2-4 as a whole, so this would print that the compound expression is False.
question
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
True Why: ... If (x=5) < (y=3), this is False. OR = the operator , one of these expressions must be true. (z=8) > (x=5), this is True The whole statement is True because it uses the OR operator not the AND condition.
question
Decision structures are also known as selection structures.
True
question
A(n) ________ structure is a logical design that controls the order in which a set of statements execute.
control
question
A Boolean variable can reference one of two values: ________.
true or false
question
In Python, the ________ symbol is used as the not-equal-to operator.
!=
question
When using the ________ operator, both sub-expressions must be true for the compound expression to be true.
and
question
Nested decision structures are one way to test more than one condition.
True
question
When using the ________ operator, one or both subexpressions must be true for the compound expression to be true.
Or
question
An action in a single alternative decision structure is performed only when the condition is true.
True
question
Which logical operators perform short-circuit evaluation?
or, and
question
Expressions that are tested by the if statement are called Boolean expressions.
True
question
The Python language is not sensitive to block structuring of code.