Exam 6: Loops
Exam 1: Introduction76 Questions
Exam 2: Using Objects82 Questions
Exam 3: Implementing Classes108 Questions
Exam 4: Fundamental Data Types124 Questions
Exam 5: Decisions119 Questions
Exam 6: Loops107 Questions
Exam 7: Arrays and Array Lists117 Questions
Exam 8: Designing Classes88 Questions
Exam 9: Inheritance99 Questions
Exam 10: Interfaces100 Questions
Exam 11: Input/Output and Exception Handling108 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion99 Questions
Exam 14: Sorting and Searching100 Questions
Exam 15: The Java Collections Framework102 Questions
Exam 16: Basic Data Structures102 Questions
Exam 17: Tree Structures102 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Stream Processing85 Questions
Exam 20: Graphical User Interfaces75 Questions
Exam 21: Advanced Input/Output90 Questions
Exam 22: Multithreading81 Questions
Exam 23: Internet Networking74 Questions
Exam 24: Relational Databases75 Questions
Exam 25: XML74 Questions
Select questions type
For which input values will the following loop not correctly compute the maximum of the values?

Free
(Multiple Choice)
4.8/5
(28)
Correct Answer:
D
How many times does the following code fragment display "Hi"?

Free
(Multiple Choice)
4.7/5
(35)
Correct Answer:
C
The code snippet below checks whether a given number is a prime number.What will be the result of executing it?

Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
B
Which of the following statements expresses why the following code is considered bad form?
for (rate = 5; years-- > 0; System.out.println(balance))
...
I.unrelated expressions in loop header
II.doesn't match expected for loop idiom
III.loop iteration is not clear
(Multiple Choice)
4.9/5
(49)
Which of the following loops will print the odd numbers between 0 and 20?
(Multiple Choice)
4.8/5
(46)
The for loop header can contain multiple variables of the same type and multiple update expressions, separated by commas:
for (int i = 0; j = 3; i <= 5; i++, j--)
Which loop below correctly implements the same loop using a single counter in the loop control?
(Multiple Choice)
4.9/5
(29)
Which of the following loop(s) could possibly not enter the loop body at all?
I.the for loop
II.the while loop
III.the do loop
(Multiple Choice)
4.9/5
(41)
What will be the result of running the following code fragment?

(Multiple Choice)
4.8/5
(38)
What changes do you need to make in the following code snippet to display "Let us learn Java" exactly 10 times?

(Multiple Choice)
4.8/5
(44)
What is the last output line of the code snippet given below?

(Multiple Choice)
4.8/5
(37)
Assuming the variable n is an integer that stores a positive value, which of the following is a loop with a bound that could be problematic?
(Multiple Choice)
4.9/5
(38)
Showing 1 - 20 of 107
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)