Exam 5: Loops and Files
Exam 1: Introduction to Computers and Java40 Questions
Exam 2: Java Fundamentals40 Questions
Exam 3: A First Look at Classes and Objects40 Questions
Exam 4: Decision Structures42 Questions
Exam 5: Loops and Files40 Questions
Exam 6: A Second Look at Classes and Objects40 Questions
Exam 7: Arrays and the Arraylist Class40 Questions
Exam 8: Text Processing and Wrapper Classes40 Questions
Exam 9: Inheritance40 Questions
Exam 10: Exceptions and Advanced File Io40 Questions
Exam 11: Java-Fx: Gui Programming and Basic Controls40 Questions
Exam 12: Java-Fx: Advanced Controls40 Questions
Exam 13: Java-Fx: Graphics, Effects, and Media40 Questions
Exam 14: Recursion24 Questions
Exam 15: Databases40 Questions
Select questions type
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
(41)
When working with the PrintWriter class, which of the following import statements should you have near the top of your program?
(Multiple Choice)
4.9/5
(32)
A loop that executes as long as a particular condition exists is called a(n) __________ loop.
(Multiple Choice)
4.9/5
(35)
The __________ loop is ideal in situations where the exact number of iterations is known.
(Multiple Choice)
5.0/5
(31)
Which of the following statements opens a file named MyFile.txt and allows you to read data from it?
(Multiple Choice)
4.7/5
(39)
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
(42)
When the continue 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
(32)
Given the following statement, which statement will write the string "Calvin" to the file DiskFile.txt? PrintWriter diskOut = new PrintWriter("DiskFile.txt");
(Multiple Choice)
4.9/5
(36)
What will be the value of x after the following statements are executed? int x = 10;
For (int y = 5; y < 20; y +=5)
X += y;
(Multiple Choice)
4.8/5
(28)
You can use the PrintWriter class to open a file and write data to it.
(True/False)
4.9/5
(44)
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
(44)
The do-while loop is ideal in situations where you always want the loop to iterate at least once.
(True/False)
4.7/5
(36)
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.8/5
(29)
The for loop is a posttest loop that has built-in expressions for initializing, testing, and updating.
(True/False)
4.7/5
(44)
The variable used to keep a running total in a loop is called a(n) __________.
(Multiple Choice)
4.8/5
(28)
A loop that repeats a specific number of times is known as a(n)
(Multiple Choice)
4.9/5
(41)
What will be the value of x after the following code is executed? int x = 10;
While (x < 100)
{
X += 100;
}
(Multiple Choice)
4.8/5
(31)
Showing 21 - 40 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)