Exam 4: Loops and Files

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

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.7/5
(38)

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
(37)

In all but rare cases,loops must contain within themselves

(Multiple Choice)
4.9/5
(37)

Which of the following will open a file named MyFile.txt and allow you to read data from it?

(Multiple Choice)
4.7/5
(35)

In the for loop,the control variable cannot be initialized to a constant value and tested against a constant value.

(True/False)
4.9/5
(39)

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

(Multiple Choice)
4.8/5
(39)

Assume that inputFile references a Scanner object that was used to open a file.Which of the following while loops shows the correct way to read data from the file until the end of the file is reached?

(Multiple Choice)
4.8/5
(42)

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
(41)

You can use the PrintWriter class to open a file for writing and write data to it.

(True/False)
4.7/5
(25)

Given the following statement,which statement will write "Calvin" to the file DiskFile.txt? PrintWriter diskOut = new PrintWriter("DiskFile.txt");

(Multiple Choice)
4.7/5
(33)

What will be the values of x and y as a result of the following code? int x = 12,y = 5; X += y--;

(Multiple Choice)
4.8/5
(45)

Which of the following will open a file named MyFile.txt and allow you to append data to its existing contents?

(Multiple Choice)
4.8/5
(41)

This type of loop is ideal in situations where you always want the loop to iterate at least once.

(Multiple Choice)
4.9/5
(44)

The do-while loop is a pre-test loop.

(True/False)
4.8/5
(36)

This type of loop is ideal in situations where the exact number of iterations is known.

(Multiple Choice)
4.8/5
(39)

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

(Multiple Choice)
4.7/5
(35)

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

(Multiple Choice)
5.0/5
(43)

A for loop normally performs which of these steps?

(Multiple Choice)
4.8/5
(33)

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

(Multiple Choice)
4.9/5
(36)

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.7/5
(29)
Showing 21 - 40 of 48
close modal

Filters

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