Lab 8.2 Self-Review Questions
In order to test your progress, you should be able to answer the following questions. 1) |
How many times is a WHILE loop executed if the test condition always evaluates to FALSE? _____ The loop does not execute at all. _____ The loop executes once. _____ The loop executes an infinite number of times. | 2) |
How many times is a WHILE loop executed if the test condition always evaluates to TRUE? _____ The loop does not execute at all. _____ The loop executes once. _____ The loop executes an infinite number of times. | 3) |
What value must the test condition evaluate to in order for the loop to terminate? _____ TRUE _____ FALSE _____ NULL | 4) |
What causes a WHILE loop to terminate prematurely? _____ The EXIT condition evaluates to TRUE before the test condition evaluates to FALSE. _____ The test condition evaluates to FALSE before the EXIT condition evaluates to TRUE. _____ Both test and EXIT conditions evaluate to FALSE. | 5) |
A WHILE loop will execute a minimum of _____ zero times. _____ one time. _____ infinite number of times. |
Answers appear in Appendix A, Section 8.2 . |