Dealing with errors and more work with decisions and loops

Question Set 1

 
1. Give examples, in pseudocode, of each of the following nested loops:
 
  1. a repeat loop within a repeat loop
  2. a while loop within a while loop
  3. a repeat loop within a while loop
  4. a while loop within a repeat loop
2. When is it safe to leave the ENDIF off an IF ... THEN ... ELSE ... statement?

3. Give two reasons for indenting pseudocode.

4. Show how you would indentation with an IF ... THEN ... ELSE ... statement.

5. List three sources of errors in program design.

6. Briefly describe a strategy for testing program designs.

7. What is meant by a boundary value?

8. Give an example in pseudocode of a loop which uses boundary values.

9. What is meant by a sentinel value?

10. Give an example in pseudocode which uses a sentinel value.

11. What care should be taken when using sentinel values in loops?

12. What is meant by priming a loop?

13. Give an example of priming a while loop?

14. Can repeat loops be primed? Explain your answer.

15. What is meant by multiway selection?

16. Give an example in pseudocode of multiway selection.



Return to the lesson


and may not be reproduced by any means without the written
 

This publication is copyright David Beech and Learning Systems 1997-2002
and may not be reproduced by any means without the written permission of
David Beech.
9 Wyndella Street, Tasmania, Australia


db@codelearn.com