Chapter 4 Flashcards

1
Q

A __________ -controlled loop uses a true/false condition to control the number of
times that it repeats.

A

sentinel loop

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

A __________ -controlled loop repeats a specific number of times.

A

count-controlled loop

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

Each repetition of a loop is known as a(n) __________.

A

an iteration

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

The while loop is a __________ type of loop.

A

pretest loop

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

A(n) __________ loop has no way of ending and repeats until the program is interrupted

A

infinite

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

The -= operator is an example of a(n) __________ operator.

A

The -= operator is an example of a(n) __________ operator.

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

A(n) __________ variable keeps a running total.

A

accumulator

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

A(n) __________ is a special value that signals when there are no more items from a list of items to be processed. This value cannot be mistaken as an item from the list.

A

sentinel

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

GIGO stands for

A

garbage in, garbage out

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

The integrity of a program’s output is only as good as the integrity of the program’s

A

input

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

The input operation that appears just before a validation loop is known as the

A

priming read

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

Validation loops are also known as

A

error traps

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

What is a repetition structure?

A

A structure that causes a section of code to repeat

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

What is a condition-controlled loop?

A

A loop that uses a true/false condition to control the number of times that it repeats

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

What is a count-controlled loop?

A

A loop that repeats a specific number of times

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

Validation loops are also known as__

A

error traps

17
Q

The input operation that appears just before a validation loop is known as the

A

the priming read

18
Q

What are the values that the variable num contains through the iterations of the following for loop?

for num in range(4):

A

0,1,2,3

19
Q

What are the values that the variable num contains through the iterations of the following for loop?

for num in range(2, 9, 2):

A

2,4,6,8

20
Q

What are the values that the variable num contains through the iterations of the following for loop?

for num in range(10, 1, -1):

A
21
Q

How many numbers of loop iterations will both of the following for clauses generate?
for num in range(4):

Ans:

for num in range(1, 5):

     Ans:
A
22
Q

What will be displayed after the following code is executed?

total = 0

for count in range(1,4):

total += count

print(total)

Ans:

A
23
Q

What will be displayed after the following code is executed?
count = 4

while count < 12:

print("counting")

count = count + 2
A
24
Q

x = 99
while x > 0:
print (x)

ANS:

A