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 Structures40 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 I/O40 Questions
Exam 11: GUI Applications–Part 140 Questions
Exam 12: GUI Applications–Part 240 Questions
Exam 13: Applets and More40 Questions
Exam 14: Creating GUI Applications with JavaFX40 Questions
Exam 15: Recursion20 Questions
Exam 16: Databases40 Questions
Select questions type
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
(87)
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.7/5
(79)
What does the following code do?
Scanner keyboard = new Scanner(System.in);
String filename;
System.out.print("Enter the filename: ");
Filename = keyboard.readString();
PrintWriter outFile = new PrintWriter(filename);
(Multiple Choice)
5.0/5
(85)
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
(76)
In all but rare cases, loops must contain within themselves
(Multiple Choice)
4.9/5
(73)
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
(91)
The for loop is a posttest loop that has built-in expressions for initializing, testing, and updating.
(True/False)
4.9/5
(75)
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
(88)
Before entering a loop to compute a running total, the program should first
(Multiple Choice)
4.9/5
(93)
You can use this method to determine whether a file exists.
(Multiple Choice)
4.9/5
(65)
A loop that repeats a specific number of times is known as a(n) ________ loop.
(Multiple Choice)
4.9/5
(90)
A loop that executes as long as a particular condition exists is called a(n) ________ loop.
(Multiple Choice)
4.7/5
(94)
The while loop is ideal in situations where the exact number of iterations is known.
(True/False)
4.9/5
(74)
The do-while loop is ideal in situations where you always want the loop to iterate at least once.
(True/False)
4.8/5
(79)
How many times will the following do-while loop be executed?
Int x = 11;
Do
{
X += 20;
} while (x > 100);
(Multiple Choice)
4.9/5
(89)
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 from the list to be processed.
(Multiple Choice)
4.7/5
(83)
Showing 21 - 40 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)