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
This type of loop will always be executed at least once.
Free
(Multiple Choice)
4.8/5
(42)
Correct Answer:
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:
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:
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)
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)
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)
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)
Showing 1 - 20 of 57
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)