Questions:

  1. How can a program determine when a loop should end?   [Answer]

  2. What is the general structure of a loop?   [Answer]

  3. What happens when the flow of control reaches the EndWhile at the bottom of the loop?   [Answer]

  4. Why is it important to design the loop test carefully?   [Answer]

  5. Describe what happens in the following loop.   [Answer]

Integer DONE := 5
Integer
count := 1


While
(count <= DONE)
   
count := count + 1
EndWhile

  1. Describe what happens in the following loop.   [Answer]

Integer DONE := 0
Integer
count := 8


While
(count >= DONE)
   
count := count - 2
EndWhile

  1. Describe what happens in the following loop.   [Answer]

Integer DONE := 7
Integer
count := 2


While
(NOT (count = DONE))
   
count := count + 2
EndWhile