Chapter 7 Outcomes
The Elements of Programming: Counted Repetition


After completing this chapter and participating in class, you should be able to accomplish each of the following outcomes.

Knowledge Outcomes

  1. Define each of the key terms listed in the chart below.

  2. counted loop initialization in declaration index of counted loop
    decreasing for and end for range
    local variables step size by
    character graphics locate nested loop
    paragraphing a program color in graphics color monitor
    colorNumber colorback background color
    function repeat echo input
    string input token  

  3. Describe the purpose of the index in a counted loop.

  4. Explain why it is not necessary to include the data type when declaring a variable if the variable is being initialized with a value.

  5. Describe the range of a counted loop.

  6. State the value of the index each time the loop is executed.

  7. Describe the circumstance which makes a variable local

  8. State the data type which a variable automatically becomes when it appears after the keyword for.

  9. Compare and contrast the counted loop program "avgfive" with conditional loop program "avg5" for each of the following constructs:

  10. Describe the origin and size (based on rows and columns) of the character graphic window.

  11. Explain why two dots must follow the put instruction when outputing characters using the locate instruction (for earlier versions of the Turing Interpreter).

  12. Explain how the inner loop is affected by the outer loop when loops are nested.

  13. Explain why nested loops cannot have the same index variable.

  14. State the advantages of using an exit when condition in a counted loop.

Skills Outcomes

  1. Create a regular loop that is able to count by using a variable in combination with the loop and end loop construct along with the exit when.

  2. Create a counted loop that counts backwards by using the keyword decreasing.

  3. Create a counted loop that uses the keyword by to change the step size of the index.

  4. Modify a regular loop to use a different increment value.

  5. Modify a regular loop such that it can be made to count backwards.

  6. Use the locate instruction to output a character anywhere in the execution window.

  7. Change the color of characters by using the color instruction.

  8. Show how to cause a character to blink.

  9. Affect the background color of a character by using the colorback instruction.

  10. Combine the properties of a counted loop with a conditional loop by using an exit when in the body of the counted loop.

  11. Create a nested loop.

  12. Use the repeat function to produce a pattern that is repeated a given number of times.

  13. Detect and correct a variety of common errors when creating counted loops as outlined in the chapter.