A Slightly Different For-Loop
The for-loop on this page is just a little
different from the basic for-loop. These
differences appear fairly often, but they are not very
noticable. We repeat some of the questions asked about the
basic for-loop in order to sensitize you to the
impact of these small variations.
Download files: ASlightlyDifferentForLoop.java
Areas: Introduction to loops.
Download files: ASlightlyDifferentForLoop.java
Areas: Introduction to loops.
|
|
ASlightlyDifferentForLoop.java |
|
|
| Question 1 |
| What is the test of the loop? |
| Question 2 |
| What is the starting value of the loop counter? |
| Question 3 |
| What is the value of the loop counter the last time the loop is executed? |
| Question 4 |
| What does the loop do? |
| Question 5 |
| What is the value of the loop counter the last time it is tested? |
| Question 6 |
| How many times will the body of the loop be executed? |
| Question 7 |
| How many times will the test be evaluated? |
| Question 8 |
| How many times will the loop counter be incremented? |
| Question 9 |
| Which parts of this code can cause the loop to exit? |
| Question 10 |
| Under what conditions will this loop exit? |
