Chapter 4 Loops

  1. A _______ loop executes statements repeatedly while the condition is true.
  2. The loop-continuation-condition must always appear within the __________.
  3. (count < 100) is an example of a ______ ______ ______.
    loop continuation condition.
  4. In order for the loop-continuation-condition to eventually terminate it will have to eventually become _______.
  5. A _______ loop is the same as a while loop except it executes the loop body first and then checks the loop continuation condition.
  6. A ________ loop has a concise syntax for writing loops.
  7. Three types of repetition statements (loops) are:
    • while
    • do-while
    • for
  8. The part of the loop that contains the statements to be repeated is called the _____ ______
    loop body
  9. A one time execution of a loop body is referred to as an _______ of the loop.
  10. An ______ loop is a loop that executes infinitely.
  11. The while loop checks the ______ _____ ______ first. If the condition is true, the loop body is _________.  If it is false, the loop ________.
    • loop-continuation-condition
    • executed
    • terminates
  12. A _______ value is a special value that signifies the end of a loop.
  13. The ____ loop generally is used to execute a loop body a predictable number of times; this number is not determined by the loop body.
  14. The while and for loop are called the _____ loops because the continuation condition is checked before the loop body is executed.
  15. The do-while loop is called a _________ loop because the continuation condition is checked after the loop body is executed.
  16. Looping makes computer programming ______ and ________.
    • efficient
    • worthwhile
  17. A loop is a structure that ______ ______ while some condition continues.
    repeats actions.
  18. A _______ loop executes a predetermined number of times.
  19. Loop control variables are altered by ________ and _______.
    • incrementing
    • decrementing
  20. A _______ ______ loop is a program that counts loop repetitions.
    counter - controlled
  21. True or false. An indefinite loop and infinite loop are the same.
  22. A for loop automatically does these 3 things:
    • Initializes
    • Evaluates
    • Increments
  23. An ________ is a variable that gathers values.
  24. These 3 steps must occur in every loop:
    • Initialize loop control variable
    • Compare variable to some value
    • Alter the variable that controls the loop
  25. Loops within loops are called ______ loops.
  26. Nested loops maintain two individual ______ _______ ________.
    loop control variables
  27. Loops are used to ensure data is ______ by prompting the ______.
    • valid
    • user
  28. A _______ loop is used with definite loops when number of _______ is known.
    • for
    • iterations
  29. 4 common mistakes made by programmers:
    • Neglecting to initialize loop control variable
    • Neglecting to alter loop control variable
    • Using wrong comparison with loop control variable
    • Including statements inside the loop that belong outside the loop.
Card Set
Chapter 4 Loops