Exam 4: Loops and Files
Exam 1: Introduction to Computers and Java42 Questions
Exam 2: Java Fundamentals53 Questions
Exam 3: Decision Structures52 Questions
Exam 4: Loops and Files48 Questions
Exam 5: Methods50 Questions
Exam 6: A First Look at Classes49 Questions
Exam 7: A First Look at Gui Applications49 Questions
Exam 8: Arrays and the Arraylist Class52 Questions
Exam 9: A Second Look at Classes and Objects40 Questions
Exam 10: Text Processing and More About Wrapper Classes49 Questions
Exam 11: Inheritance49 Questions
Exam 12: Exceptions and Advanced File Io46 Questions
Exam 13: Advanced Gui Applications46 Questions
Exam 14: Applets and More39 Questions
Exam 15: Recursion34 Questions
Exam 16: Sorting, Searching, and Algorithm Analysis46 Questions
Exam 17: Generics50 Questions
Exam 18: Collections50 Questions
Exam 19: Array-Based Lists20 Questions
Exam 20: Linked Lists36 Questions
Exam 21: Stacks and Queues36 Questions
Exam 22: Binary Trees, Avl Trees, and Priority Queues45 Questions
Select questions type
A file must always be opened before using it and closed when the program is finished using it.
Free
(True/False)
4.9/5
(29)
Correct Answer:
True
How many times will the following do-while loop be executed? int x = 11;
Do
{
X += 20;
}
While (x < = 100);
Free
(Multiple Choice)
4.9/5
(45)
Correct Answer:
D
How many times will the following do-while loop be executed? int x = 11;
Do
{
X += 20;
} while (x > 100);
Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
B
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.8/5
(40)
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
(30)
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.8/5
(42)
What will be the value of x after the following code is executed? int x = 10;
While (x < 100)
{
X += 10;
}
(Multiple Choice)
5.0/5
(39)
A loop that executes as long as a particular condition exists is called a(n)
(Multiple Choice)
4.8/5
(35)
This is a sum of numbers that accumulates with each iteration of a loop.
(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.7/5
(31)
You can use this method to determine whether a file exists.
(Multiple Choice)
4.9/5
(34)
When you pass the name of a fi le 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.8/5
(31)
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.9/5
(29)
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.9/5
(34)
In a for statement,the control variable can only be incremented.
(True/False)
4.7/5
(35)
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
(44)
Before entering a loop to compute a running total,the program should first do this.
(Multiple Choice)
4.9/5
(39)
Showing 1 - 20 of 48
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)