Table 1 shows three tests used to check the algorithm in Figure 1.
Complete the table to show what the values of the validRange and tempDiff variables would be for the given test data.
Figure 1
1 validRange ← False
2 REPEAT
3 tempDiff ← -999
4 OUTPUT 'Enter minimum temperature: '
5 minTemp ← USERINPUT
6 OUTPUT 'Enter maximum temperature: '
7 maxTemp ← USERINPUT
8 IF minTemp ≥ maxTemp THEN
9 OUTPUT 'Minimum must be less than maximum'
10 ELSE
11 IF minTemp < -10 THEN
12 OUTPUT 'Minimum temp is too cold'
13 ELSE
14 validRange ← True
15 ENDIF
16 ENDIF
17 UNTIL validRange = True
18 tempDiff ← maxTemp - minTemp
19 OUTPUT tempDiff
Table 1
| Test type | Test data | Value | validRange | tempDiff |
|---|---|---|---|---|
| Normal | minTemp | -5 | ||
| maxTemp | 15 | |||
| Erroneous | minTemp | 10 | ||
| maxTemp | 5 | |||
| Boundary | minTemp | -10 | ||
| maxTemp | 10 |
208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.