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
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
(44)
If you are using a block of statements, don't forget to enclose all of the statements in a set of:
(Multiple Choice)
4.8/5
(43)
This is a value that signals when the end of a list of values has been reached.
(Multiple Choice)
4.9/5
(37)
What will be the value of x after the following code is executed? int x, y = 4, z = 6;
X = (y++) * (++z);
(Multiple Choice)
4.9/5
(36)
A sentinel value _________ and signals that there are no more values to be entered.
(Multiple Choice)
4.8/5
(35)
Java provides a set of simple unary operators designed just for incrementing and decrementing variables.
(True/False)
4.7/5
(48)
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)
4.8/5
(47)
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
(30)
Which of the following will open a file named MyFile.txt and allow you to append data to its existing contents?
(Multiple Choice)
4.8/5
(27)
This type of loop is ideal in situations where you always want the loop to iterate at least once.
(Multiple Choice)
4.8/5
(43)
A loop that executes as long as a particular condition exists is called a(n)
(Multiple Choice)
4.8/5
(33)
A loop that repeats a specific number of times is known as a(n)
(Multiple Choice)
4.9/5
(48)
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
(37)
Given the following statement, which statement will write "Calvin" to the file DiskFile.txt? PrintWriter diskOut = new PrintWriter("DiskFile.txt");
(Multiple Choice)
4.9/5
(33)
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
(32)
A file must always be opened before using it and closed when the program is finished using it.
(True/False)
4.8/5
(37)
How many times will the following do-while loop be executed? int x = 11;
Do
{
X += 20;
}
While (x <= 100);
(Multiple Choice)
5.0/5
(40)
This type of loop allows the user to decide the number of iterations.
(Multiple Choice)
4.8/5
(39)
Showing 21 - 40 of 57
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)