Chapter 8 Flashcards

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

TF

A Python while implements a definite loop.

A

False

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

TF

The counted loop pattern uses a definite loop.

A

True

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

TF

A sentinel loop asks the user whether to continue on each iteration.

A

False

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

TF

A sentinel loop should not actually process the sentinel value.

A

True

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

TF

The easiest way to iterate through the lines of a file in Python is to use a while loop.

A

False

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

TF

A while loop is a post-test loop.

A

False

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

TF

The Boolean operator or return True when both of its operands are true.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
TF
a and (b or c) == (a and b) or (a and c
A

True

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

TF

not(a or b) == (not a) or not(b)

A

False

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

TF

True or False

A

True

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

A loop pattern that asks the user whether to continue on each iteration is called a(n)

A

Interactive loop

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

A loop pattern that continues until a special value is input is called a(n)

A

sentinel loop

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

A loop structure that tests the loop condition after executing the loop body is called a

A

Post-test-loop

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

A priming read is part of the pattern for a(n)

A

sentinel loop

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

What statement can be executed in the body of a loop to cause it to terminate?

A

Break

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

Which of the following is not a valid rule of Boolean algebra?

A

It should be: not(a and b) == not(a) or not(b)

17
Q

A loop that never terminates is called

A

Infinite

18
Q

Which line would not be found in a truth table for and?

A

T F T

19
Q

Which line would not be found in a truth table for or?

A

F T F

20
Q

The term for an operator that may not evaluate one of its subexpressions is

A

Short-circuit