Chapter 5 T/F Review - Computer Programming
The while loop is always the best choice in situations where the exact number of iterations is known.
False
In a for loop, the control variable is always incremented.
False
The for loop is a posttest loop that has built-in expressions for initializing, testing, and updating.
False
When the break statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
False
The do-while loop is ideal in situations where you always want the loop to iterate at least once.
True
When you pass the name of a file to the PrintWriter constructor and the file already exists, it will be erased and a new empty file with the same name will be created.
True
You can use the PrintWriter class to open a file and write data to it.
True
When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
True
When you open a file with the PrintWriter class, the class can potentially throw an IOException.
True
A file must always be opened before using it and closed when the program is finished using it.
True