Starting Out w/ Python: Ch. 4

¡Supera tus tareas y exámenes ahora con Quizwiz!

Python allows you to compare strings, but it is not case sensitive.

FALSE

Python uses the same symbols for the assignment operator and the equality operator.

FALSE

Short-circuit evaluation is performed with the not operator.

FALSE

The Python language is not sensitive to block structuring of code.

FALSE

The not operator is a unary operator and it must be a compound expression.

FALSE

An action in a single alternative decision structure is performed only when the condition is true.

TRUE

Decision structures are also known as selection structures.

TRUE

Expressions that are tested by the if statement are called Boolean expressions.

TRUE

Nested decision structures are one way to test more than one condition.

TRUE

The if statement causes one or more statements to execute only when a Boolean expression is true.

TRUE

In Python the _____ symbol is used as the equality operator. a. == b. = c. >= d. <=

a. ==

When using the _____ operator, one or both subexpressions must be true for the compound expression to be true. a. Or b. And c. Not d. Maybe

a. Or

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:

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. true b. false c. 8 d. 5

a. true

When using the _____ operator, both subexpressions must be true for the compound expression to be true. a. or b. and c. not d. maybe

b. and

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

b. control

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. true b. false c. 8 d. 5

b. false

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. true b. false c. 8 d. 5

b. false

A Boolean variable can reference one of two values: _____. a. yes or no b. true or false c. T or F d. Y or N

b. true or false

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

b. x is less than or equal to y

Multiple Boolean expressions can be combined by using a logical operator to create _____ expressions. a. sequential b. logical c. compound d. mathematical

c. compound

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

c. dual alternative

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

c. if y > 10 and y < 50

Which logical operators perform short-circuit evaluation? a. or, not b. not, and c. or, and d. and, or, not

c. or, and

A(n) _______________ expression is made up of two or more Boolean expressions.

compound

In a decision structure, the action is _______________ executed because it is performed only when a certain condition is true.

conditionally

In Python, the _____ symbol is used as the not-equal-to operator. a. == b. <> c. <= d. !=

d. !=

In flowcharting, the _______________ symbol is used to represent a Boolean expression.

diamond

Boolean variables are commonly used as _______________ to indicate whether a specific condition exists.

flags

The _______________ statement is used to create a decision structure.

if

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.

if-elif-else

A(n) _______________ statement will execute one block of statements if its condition is true, or another block if its condition is false.

if-else

The logical _______________ operator reverses the truth of a Boolean expression.

not

A(n) _______________ operator determines whether a specific relationship exists between two values.

relational

A(n) _______________ decision structure provides only one alternative path of execution.

single alternative


Conjuntos de estudio relacionados

Sociology, Chapter 8: RACE AND ETHNICITY AS LIVED EXPERIENCE

View Set

AP Macroeconomics Midterm Unit 1

View Set

Pharmaceutics II Exam 1: Introduction, Ophthalmic Preparations, Pharmaceutical Solutions, Solid Dosage Forms

View Set

The South During Reconstruction - Lesson - 18.3

View Set

SCIENTIFIC METHOD LAB (PILL BUG) - WEEK 2

View Set

Knee anatomy: bones and ligaments

View Set