on Counting Loops
Instructions: For each question, choose the single best answer. Make your choice by
clicking on its button. You can change your answers at any time. When the quiz is graded, the
correct answers will appear in the box after each question.
1. What three parts of a counting loop must be coordinated in order for the loop to work
properly?
A.
B.
C.
D.
recapitulation
B.
tintinabulation
C.
iteration
D.
reiteration
http://chortle.ccsu.edu/Java5/Notes/chap16/chap16quizRev2.html
1/5
11/8/2014
C.
D.
123456
B.
02468
C.
024
D.
0246
1234567
B.
7654
C.
6543
D.
76543
http://chortle.ccsu.edu/Java5/Notes/chap16/chap16quizRev2.html
2/5
11/8/2014
-2 -1 1 2 3 4
B.
-2 -1 1 2 3
C.
-3 -4 -5 -6 -7
D.
-2 -1 0 1 2
1234
B.
12345
C.
234
D.
11111111111....
3/5
11/8/2014
int count = 1;
while ( ___________ )
{
System.out.print( count + " " );
count = count + 1;
}
System.out.println( );
What condition should be used so that the code writes out:
1 2 3 4 5 6 7 8
A.
count < 8
B.
count < 9
C.
count+1 <= 8
D.
count != 8
9. Which of the following situation most likely does NOT call for a counting loop?
A.
B.
C.
Prompting the user of a program until the user responds with correct information.
D.
The "wrong way" problem, where a two way decision is written incorrectly.
B. The "wrong operator" problem, where an arithmetic expression does not mean
what the programmer thought it did.
C. The "unititialized variable" problem, where a variable is used in an expression
before its contents have been initialized.
D. The "off by one" problem, where a counting loop executes its body one time too
many or one time too few.
D
http://chortle.ccsu.edu/Java5/Notes/chap16/chap16quizRev2.html
4/5
11/8/2014
grade quiz
10
Percent Correct:
100
Letter Grade:
If you have returned here from another page, or have re-loaded this page, you
will need to click again on each of your choices for the grading program to
work correctly. You may want to press the SHIFT KEY while clicking to clear
the old answers.
http://chortle.ccsu.edu/Java5/Notes/chap16/chap16quizRev2.html
5/5