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
If a loop does not contain within itself a way to terminate, it is called
Free
(Multiple Choice)
4.8/5
(89)
Correct Answer:
B
What will be the value of x after the following code is executed?
Int x = 10;
While (x < 100)
{
X += 10;
}
Free
(Multiple Choice)
4.9/5
(71)
Correct Answer:
A
A ________ is a value that signals when the end of a list of values has been reached.
Free
(Multiple Choice)
4.9/5
(71)
Correct Answer:
B
Which of the following statements opens a file named MyFile.txt and allows you to read data from it?
(Multiple Choice)
4.9/5
(92)
You can use the PrintWriter class to open a file and write data to it.
(True/False)
4.8/5
(74)
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
(69)
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
(78)
What will be the value of x after the following code is executed?
Int x = 10;
For (int y = 5; y < 20; y +=5)
X += y;
(Multiple Choice)
5.0/5
(74)
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
(66)
The ________ is ideal in situations where the exact number of iterations is known.
(Multiple Choice)
4.8/5
(56)
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.8/5
(81)
A file must always be opened before using it and closed when the program is finished using it.
(True/False)
5.0/5
(75)
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.9/5
(93)
Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents?
(Multiple Choice)
4.9/5
(77)
When you open a file with the PrintWriter class, the class can potentially throw an IOException.
(True/False)
4.7/5
(92)
The ________ loop is ideal in situations where you always want the loop to iterate at least once.
(Multiple Choice)
4.8/5
(90)
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.
(True/False)
4.7/5
(94)
What will be the value of x after the following code is executed?
Int x, y = 15;
X = y--;
(Multiple Choice)
4.8/5
(65)
Showing 1 - 20 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)