Chapter 4 Flashcards

1
Q

Loop control variable

A

A variable that controls the number of iterations preformed by a loop

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

While loop type

A

Pretest

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

Do while loop type

A

Post test

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

For loop type

A

Pretest loop

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

This type of loop always executes at least once

A

Do-while

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

This expression is executed by the for loop only once, regardless of iterations

A

Initializing expression

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

This variable keeps a running total

A

Accumulator

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

To open a file for writing you use

A

PrintWriter

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

To open a file for reading

A

File and scanner

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

This class allows you to use the print and println methods to write data into a file

A

PrintWriter

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

This class allows you to read a line from a file

A

Scanner

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

(True or false) the while loop is a pretest loop

A

True

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

(True or false) the do-while loop is a pre-test loop

A

False

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

(True or false) The for loop is a post test loop

A

False

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

(True or false) it is not necessary to initialize the accumulator variables

A

False

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

(True or false) one limitation of the for loop is that only one variable may be initialized in the initialization expression

A

False

17
Q

(True or false)A variable may be defined in the initialization expression of the for loop

A

True

18
Q

(True or false) In a nested loop, the inner loop goes through all of its iterations for every iteration of the outer loop

A

True

19
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