Exam 6: Flow of Control, Part 2: Looping

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

while loops can be nested.

(True/False)
4.9/5
(45)

Which Java class enables us to read data easily from a file?

(Multiple Choice)
4.8/5
(41)

Evaluate this code segment, explaining any errors: 12 int count = 1; 13 int total = 1; 14 final int SENTINEL = -1; 15 int score;

(Essay)
4.8/5
(33)

Putting a semicolon after the loop condition of a while loop will most likely result in a(n) __________ or endless loop.

(Short Answer)
4.8/5
(36)

Curly braces around the loop body are optional if the loop body consists of only one statement.

(True/False)
4.7/5
(34)

How many times will a loop with the for loop header for ( i = 0; i < 6; i++ ) execute?

(Multiple Choice)
4.8/5
(41)

The body of a while loop is executed until the loop condition becomes __________.

(True/False)
4.9/5
(36)

When you use a while loop to compute the average of several values, what do you have to worry about when dividing the sum of these values by the number of these values?

(Essay)
4.7/5
(36)

How many times will a loop with the for loop header for ( i = 0; i <= 6; i++ ) execute?

(Multiple Choice)
4.9/5
(38)

What is the output of this code sequence? for ( int i = 5; i >= 0; i-- ) System.out.print( i + " " ); System.out.println( );

(Short Answer)
5.0/5
(41)

The hasNext method in the Scanner class returns true if the input has another token, and false otherwise.

(True/False)
4.9/5
(35)

In the do/while loop, the loop condition is tested at the end of the loop, instead of at the beginning, as in the while loop.

(True/False)
4.8/5
(35)

How many times will a loop with the for loop header for ( i = 1; i <= 6; i++ ) execute?

(Multiple Choice)
4.8/5
(41)

The while loop condition is a boolean expression.

(True/False)
4.8/5
(35)

When you use a while loop to compute the average of several values, what variables do you need to keep track of (in addition to holding the value being processed)?

(Multiple Choice)
4.8/5
(37)

The while loop is used to process each input value, one at a time, until a signal tells us that there is no more input. This is called:

(Multiple Choice)
4.9/5
(36)

What is the argument list for the nextFloat( ) method in the Scanner class?

(Multiple Choice)
4.8/5
(36)

When reading data from a file using a while loop, the typical condition to exit the loop is when you:

(Multiple Choice)
4.8/5
(42)

How many times will a loop with the for loop header for ( i = 5; i <= 15; i++ ) execute?

(Multiple Choice)
4.9/5
(34)

The loop condition is a boolean expression.

(True/False)
4.8/5
(36)
Showing 41 - 60 of 67
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)