Chapter 4 Flashcards
Loop control variable
A variable that controls the number of iterations preformed by a loop
While loop type
Pretest
Do while loop type
Post test
For loop type
Pretest loop
This type of loop always executes at least once
Do-while
This expression is executed by the for loop only once, regardless of iterations
Initializing expression
This variable keeps a running total
Accumulator
To open a file for writing you use
PrintWriter
To open a file for reading
File and scanner
This class allows you to use the print and println methods to write data into a file
PrintWriter
This class allows you to read a line from a file
Scanner
(True or false) the while loop is a pretest loop
True
(True or false) the do-while loop is a pre-test loop
False
(True or false) The for loop is a post test loop
False
(True or false) it is not necessary to initialize the accumulator variables
False
(True or false) one limitation of the for loop is that only one variable may be initialized in the initialization expression
False
(True or false)A variable may be defined in the initialization expression of the for loop
True
(True or false) In a nested loop, the inner loop goes through all of its iterations for every iteration of the outer loop
True
(True or false) to calculate the total number of iterations of a nested loop, add the number of iterations of all the loops
False