NEW
Font size
WorksheetsPreTrainingScannerLoops
Total questions: 10
Worksheet time: 8mins
How many times does the pictured loop iterate?
(not the number of lines)
99
98
100
0
in a while or do-while loop, what comes directly after the while keyword?
curly braces
a semicolon
a condition that evaluates to true or false, enclosed in parentheses
a variable to check against
Which loop always executes at least once?
Fruit Loop
for loop
do-while loop
while loop
What method should be called when you are done using a Scanner object?
close()
end()
done()
finish()
Which of the following is NOT a type of loop in Java?
for-in
do-while
for
while
True/False: a for-each loop can be reversed to iterate from the last index of an array to the first
True
False
Given the pictured loop, what is the equivalent for loop?
for(int i=0; i++; i<5){}
for(int i=0; i<5){
i++;
}
for(int i=0; i<5; i++){}
True/False: if the condition for a while loop is false, the loop will be skipped
True
False
What package needs to be imported to use Scanner?
java.util.*
java.awt
java.io.InputStream
java.util.scanner.*
True/False: the pictured loop will result in an ArrayIndexOutOfBoundsException
True
False
