Exam 4: Loops and Files
Exam 1: Introduction to Computers and Java51 Questions
Exam 2: Java Fundamentals61 Questions
Exam 3: Decision Structures64 Questions
Exam 4: Loops and Files57 Questions
Exam 5: Methods60 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class64 Questions
Exam 8: A Second Look at Classes and Objects50 Questions
Exam 9: Text Processing and More About Wrapper Classes60 Questions
Exam 10: Inheritance70 Questions
Exam 11: Exceptions and Advanced File IO56 Questions
Exam 12: A First Look at GUI Applications60 Questions
Exam 13: Advanced GUI Applications58 Questions
Exam 14: Applets and More54 Questions
Exam 15: Creating GUI Applications With Javafx and Scene Builder40 Questions
Exam 16: Recursion42 Questions
Exam 17: Databases48 Questions
Select questions type
The while loop has two important parts: (1) a boolean expression that is tested for a true or false value, and (2) a statement or block of statements that is repeated as long as the expression is true.
(True/False)
4.7/5
(36)
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.9/5
(35)
Before entering a loop to compute a running total, the program should first do this.
(Multiple Choice)
4.8/5
(37)
What will be the value of x after the following code is executed? int x = 10;
While (x < 100);
{
X += 10;
}
(Multiple Choice)
4.8/5
(38)
This is a sum of numbers that accumulates with each iteration of a loop.
(Multiple Choice)
4.8/5
(34)
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.9/5
(40)
How many times will the following do-while loop be executed? int x = 11;
Do
{
X += 20;
} while (x > 100);
(Multiple Choice)
4.7/5
(40)
This type of loop is ideal in situations where the exact number of iterations is known.
(Multiple Choice)
5.0/5
(36)
Which of the following will open a file named MyFile.txt and allow you to read data from it?
(Multiple Choice)
4.9/5
(33)
In all but rare cases, loops must contain within themselves
(Multiple Choice)
4.9/5
(36)
____________ is the process of inspecting data given to the program by the user and determining if it is valid.
(Multiple Choice)
4.8/5
(38)
This variable controls the number of times that the loop iterates.
(Multiple Choice)
4.9/5
(44)
What will be the value of x after the following code is executed? int x = 10;
While (x < 100)
{
X += 10;
}
(Multiple Choice)
4.9/5
(32)
You can use the PrintWriter class to open a file for writing and write data to it.
(True/False)
4.9/5
(43)
What will be printed after the following code is executed? for (int number = 5; number <= 15; number +=3)
System.out.print(number + ", ");
(Multiple Choice)
4.9/5
(37)
What will be the value of x after the following code is executed? int x = 10;
Do
{
X *= 20;
}
While (x < 5);
(Multiple Choice)
4.7/5
(39)
Showing 41 - 57 of 57
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)