Chapter 4 Multiple choice questions Flashcards

1
Q

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

a) Boolean
b) condition
c) decision
d) count

A

A condition-controlled loop uses a true/false condition. (while 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) Boolean
b) condition
c) decision
d) count

A

A count-controlled loop uses a specific number. (for 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) cycle
b) revolution
c) orbit
d) iteration

A

Each repetition of a loop is known as 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
b) no-test
c) prequalified
d) post-iterative

A

The while loop is a pretest type of 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) indeterminate
b) interminable
c) infinite
d) timeless

A

An infinite loop.

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) relational
b) augmented assignment
c) complex assignment
d) reverse assignment

A

-= is an augmented assignment 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) sentinel
b) sum
c) total
d) accumulator

A

An accumulator variable keeps a running total.

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
b) flag
c) signal
d) accumulator

A

A sentinel is a special value that signals when there are no more items to be processed.

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

GIGO stands for ______.

a) great input, great output
b) garbage in, garbage out
c) GIGahertz Output
d) GIGabyte Operation

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) compiler
b) programming language
c) input
d) debugger

A

The integrity of a program’s output is only as good as the integrity of the program’s 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) prevalidation read
b) primordial read
c) initialization read
d) priming read

A

Priming read

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

Validation loops are known as ______.

a) error traps
b) doomsday loops
c) error avoidance loops
d) defensive loops

A

Validation loops are known as error traps.

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

True or False:

A condition-controlled loop always repeats a specific number of times.

A

False, a condition-controlled loop is controlled by conditions.

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

True or False:

The while loop is a preset loop.

A

True, a while loop is a preset.

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

True or False:

The following statement subtracts 1 from x: x = x -1

A

True, and it irks mathematicians to no end.

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

True or False:

It is not necessary to initialize accumulator variables.

A

False, it is necessary to initialize accumulator variables.

17
Q

True or False:

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop-

A

True, the inner loop goes through all of its iterations for every outer iteration.

18
Q

True or False:

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

A

False, you need to multiply the number of iterations of all the loops.

19
Q

True or False:

The process of input validation works as follows: when the user of a program enters invalid data, the program should ask the user “Are you sure you meant to enter that?”. If the user answers “yes,” the program should accept the data.

A

False, an error message should be displayed and the user should have to enter valid data.