Testing+Exercises+2


 * Testing: Identify the coding stage errors**

From the list of coding stage errors shown at the foot of this page, identify which of the coding stage errors they apply to.

Coding Stage Errors
 * Syntax errors
 * Initialisation errors
 * Confusion of parameters
 * Errors in loop counters
 * Incorrect handling of a decision
 * Multiple or non-definition of variables
 * Errors in writing variable names
 * Incorrect declaration of type and dimensions

1. The program "Count in 5s" has been written to count up in 5s, from 5 to 50. Download and run the program "Count in 5s" (a) Explain what happens when the program is run (b) State what needs to be done to get the program to work (c) From the list of coding stage errors, identify which coding error has caused this problem

Count in 5s Source Code Listing

2. The program "Display Name" takes a users name as input, and then displays a message to the user. Download and run the program "Display Name" (a) Explain what happens when the program is run (b) State what needs to be done to get the program to work (c) From the list of coding stage errors, identify which coding error has caused this problem

Display Name Source Code Listing

3. The program "Add Numbers" takes as input 2 integers, adds them and then outputs the answer. Download and run the program "Add Numbers". (a) Explain what happens when the program is run (b) State what needs to be done to get the program to work (c) From the list of coding stage errors, identify which coding error has caused this problem

Add Numbers Source Code Listing

4. The program "Display Stars" asks the user to enter a number, and then displays that number of stars. Download and run the program "Display Stars". (a) Explain what happens when the program is run (b) State what needs to be done to get the program to work (c) From the list of coding stage errors, identify which coding error has caused this problem

Display Stars Source Code Listing