Exam 4: Loops and Files

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

Which of the following statements opens a file named MyFile.txt and allows you to read data from it?

(Multiple Choice)
4.8/5
(37)

The __________ loop is ideal in situations where you always want the loop to iterate at least once.

(Multiple Choice)
4.9/5
(34)

In a for loop, the control variable is always incremented.

(True/False)
4.7/5
(41)

The do-while loop must be terminated with a semicolon.

(True/False)
4.8/5
(36)

The do-while loop is ideal in situations where you always want the loop to iterate at least once.

(True/False)
4.9/5
(41)

Select all that apply. Which of the following steps is normally performed by a for loop?

(Multiple Choice)
4.7/5
(32)

What will be printed after the following code is executed? for (int number = 5; number <= 15; number +=3) System.out.print(number + ", ");

(Multiple Choice)
4.8/5
(32)

Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file?

(Multiple Choice)
4.8/5
(37)

An item that separates other items is known as a

(Multiple Choice)
4.7/5
(34)

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.

(True/False)
4.8/5
(36)

If a loop does not contain, within itself, a valid way to terminate, it is called a(n) __________ loop

(Multiple Choice)
4.9/5
(46)

Which of the following expressions will generate a random number in the range of 1 through 10?

(Multiple Choice)
4.9/5
(40)

Each repetition of a loop is known as a(n) __________.

(Multiple Choice)
4.9/5
(27)

A __________ is a value that signals when the end of a list of values has been reached.

(Multiple Choice)
4.7/5
(33)

What will be the value of x after the following code is executed? int x = 10; While (x < 100) { X += 100; }

(Multiple Choice)
5.0/5
(37)

Java provides a set of simple unary operators designed just for incrementing and decrementing variables.

(True/False)
4.8/5
(38)

How many times will the following for loop be executed? for (int count = 10; count <= 21; count++) System.out.println("Java is great!");

(Multiple Choice)
4.8/5
(37)

What will be the value of x after the following code is executed? int x, y = 4, z = 6; X = (y++) * (++z);

(Multiple Choice)
4.9/5
(31)

What will be the values of x and y after the following code is executed? int x, y = 15, z = 3; X = (y--) / (++z);

(Multiple Choice)
4.7/5
(31)

A(n) __________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more data items to be processed.

(Multiple Choice)
5.0/5
(38)
Showing 21 - 40 of 56
close modal

Filters

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