Chapter 7 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

TF

A simple decision can be implemented with an if statement.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

TF

In Python conditions, ≠ is written as /=.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

TF

Strings are compared by lexicographic ordering.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

TF

A two-way decision is implemented using an if-elif statement.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

TF

The math.sqrt function cannot computer the square root or a negative number.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

TF

A single try statement can catch multiple kinds of errors.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

TF

Multi-way decisions must be handled by nesting multiple if-else statements.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

TF

There is usually only one correct solution to a problem involving decision structures.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

TF

The condition x <= y <= z is allowed in Python.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

TF

Input validation means prompting a user when input is required.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A statement that controls the execution of other statements is called a

A

control structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The best structure for implementing a multi-way decision in Python is

A

if-elif-else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

An expression that evaluates to either true or false is called

A

Boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When a program is being run directly (not imported), the value of __name__ is

A

__main__

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The literals for type bool are

A

True, False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Placing a decision inside of another decision is an example of

A

Nesting

17
Q

In Python, the body of a decision is indicated by

A

indentation

18
Q

A structure in which one decision leads to another set of decisions, which leads to another set of decisions, etc., is called a decisio

A

Tree

19
Q

Taking the square root of a negative value with math.sqrt produces a(n)

A

ValueError

20
Q

A multiple choice question is most similar to

A

multi-way decisions