Exam 4: Loops and Files

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

This type of loop will always be executed at least once.

Free
(Multiple Choice)
4.8/5
(42)
Correct Answer:
Verified

B

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

Free
(Multiple Choice)
4.7/5
(26)
Correct Answer:
Verified

A

When you pass the name of a file to the PrintWriter constructor, and the file already exists, it will be erased and a new empty file with the same name will be created.

Free
(True/False)
4.8/5
(45)
Correct Answer:
Verified

True

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

(Multiple Choice)
4.9/5
(25)

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

(Multiple Choice)
4.7/5
(36)

This is an item that separates other items.

(Multiple Choice)
5.0/5
(44)

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

In a for statement, the control variable can only be incremented.

(True/False)
4.8/5
(40)

This is a control structure that causes a statement or group of statements to repeat.

(Multiple Choice)
4.9/5
(41)

When using the PrintWriter class, which of the following import statements would you write near the top of your program?

(Multiple Choice)
4.9/5
(42)

You can use this method to determine whether a file exists.

(Multiple Choice)
4.9/5
(45)

When you open a file with the PrintWriter class, the class can potentially throw an IOException.

(True/False)
4.9/5
(43)

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

(True/False)
4.8/5
(40)

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

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

(Multiple Choice)
4.8/5
(38)

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

Each repetition of a loop is known as what?

(Multiple Choice)
4.8/5
(32)

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

In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in); System.out.print("Enter a number: "); Int number = keyboard.nextInt(); While (number < 100 && number > 500) { System.out.print("Enter another number: "); Number = keyboard.nextInt(); }

(Multiple Choice)
4.8/5
(28)

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

(True/False)
4.9/5
(37)
Showing 1 - 20 of 57
close modal

Filters

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