Loops in Java Chapter Exam

Exam Instructions:

Choose your answers to the questions and click 'Next' to see the next set of questions. You can skip questions if you would like and come back to them later with the yellow "Go To First Skipped Question" button. When you have completed the practice exam, a green submit button will appear. Click it to see your results. Good luck!

Page 1

Question 1 1. In a nested while loop what happens if there is a break in the inner loop?

Question 2 2. In the code below what gets printed after 3: 5?

Question 3 3. In a nested while loop, which loop is executed first?

Question 4 4. In the code below what gets printed after 2: 5?

Question 5 5. What is a nested while loop in Java?

Page 2

Question 6 6. What will be the value of the variable tester value when this loop is finished?

Question 7 7. Which is the correct syntax?

Question 8 8. A for loop includes a _____, which increases or decreases through each step of the loop

Question 9 9.

Look at the following code. When will the processing stop?

for(i=0;i<25;i++)

Question 10 10. A for loop inside another for loop is called a _____ loop

Page 3

Question 11 11. Examine the following code. Is there anything that will prevent it from processing?

Question 12 12. How often is the inner loop of a nested loop run?

Question 13 13. Examine the following code. How many times will the nested loop run?

Question 14 14. Examine the following code. Will the j loop process?

Question 15 15. Java limits the number of nested for loops to _____

Page 4

Question 16 16. Which code sample will result in an infinite while loop?

Question 17 17. Examine the following code. This will create an infinite loop. What can be added to stop this from happening?

Question 18 18. Which condition tells the system to stop processing the code within the loop?

Question 19 19. When does an infinite loop happen?

Question 20 20. An infinite loop probably wouldn't run forever; instead Java will _____, stopping processing.

Page 5

Question 21 21. A while loop can evaluate _____ condition(s)

Question 22 22. What will be the result of the following code?

Question 23 23. A while loop runs code as long as the condition(s) is/are:

Question 24 24. A while loop is considered _____ if you don't know when the condition will be true

Question 25 25. Which is the correct syntax for a while loop?

Page 6

Question 26 26. Examine the following code. What do you think will happen when it runs?

Question 27 27. Examine the following code. Will the statement being printed ever show up?

Question 28 28. In a Java Do-While loop, the condition is evaluated at the _____ of the statement.

Question 29 29. Examine the following code. What is missing?

Question 30 30. How many times is any Do-While loop executed?

Loops in Java Chapter Exam Instructions

Choose your answers to the questions and click 'Next' to see the next set of questions. You can skip questions if you would like and come back to them later with the yellow "Go To First Skipped Question" button. When you have completed the practice exam, a green submit button will appear. Click it to see your results. Good luck!

Java Programming Tutorial & Training  /  Business Courses
Support