Ch4 Test W Answers
Ch4 Test W Answers
True/False
Indicate whether the sentence or statement is true or false.
Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
int limit = n / 2;
If the user enters the number 12 when prompted, the output displayed to the console will be ____.
a. 2 c. 2 3 4 6
b. 2 3 4 5 6 d. no output
____ 25. Which of the following is an advantage of taking input data from a text file rather than a human user typing
on the keyboard?
a. The data set can be much larger.
b. The data can be input much more quickly and with less chance of error.
c. The data can be used repeatedly with the same program or with different programs.
d. All of the above are correct.
____ 26. File objects are instances of the class ____.
a. File c. Scanner
b. IO d. Stream
____ 27. I/O exceptions are generally so serious that they belong to a category called ____ exceptions, meaning that a
program must at least acknowledge they might be thrown, if not do something to recover from them.
a. unchecked c. fatal
b. acknowledged d. checked
____ 28. Data can be output to a text file using the class ____.
a. Writer c. Scanner
b. PrintWriter d. FileWriter
Matching
____ 29. A loop that stops when a counter variable reaches a specific limit.
____ 30. A diagram that displays the flow of control of a program.
____ 31. A type of statement that chooses alternate course of action based on the truth or falsity of a given condition.
____ 32. A loop in which the controlling condition is not changed in such a manner to allow the loop to terminate.
____ 33. A variable used to count the number of times some process is completed.
____ 34. A loop in which the control condition is tested before the loop is executed.
____ 35. Usually seen with loops, this error shows up as a result that is one less or one greater than the expected value.
____ 36. The process of using the same operator symbol or identifier to refer to many different functions.
____ 37. A special node in a linked structure that contains no data but instead makes the beginning or end of the
structure.
____ 38. Program statements that cause a process to be repeated.
____ 39. A special value that indicates the end of a set of data or of a process.
____ 40. A type of loop that terminates when it is finished performing some task.
16-17 FJ Ch4 Test
Answer Section
TRUE/FALSE
MULTIPLE CHOICE
MATCHING
29. ANS: G
30. ANS: A
31. ANS: I
32. ANS: H
33. ANS: C
34. ANS: D
35. ANS: K
36. ANS: F
37. ANS: J
38. ANS: B
39. ANS: E
40. ANS: L