3GL Program Design: Step-Form algorithms and Trace Tables

Question set 1

1. What is a trace table?

2. Why should you use trace tables?

3. For each of the problems which follow, construct a step-form algorithm and a trace table:

  1. Given two numbers X and Y determine which is the largest and display the largest number.
  2. Given the heights of three buildings find the average height.
  3. If Sunday is day one of the week and Saturday is day seven of the week, write an algorithm which gets a number and displays the day of the week as a word.
  4. You have a shopping list of 8 items, each item has a number on the list, a description and a price: find the total of the shopping list.
  5. With the shopping list from the previous task find the lowest priced item.

Return to the lesson

This publication is copyright Learning Systems 1997
and may not be reproduced by any means without the written
permission of Learning Systems.
P.O. Box 32, Mowbray, Tasmania, Australia