Skip to content

Course home

Representing algorithms

Representing algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
Question 27

An algorithm is designed to validate the flight parameters of a high-altitude research balloon and calculate its ascent distance.

1  validMission ← False
2  REPEAT
3      ascentDistance ← -99
4      OUTPUT 'Enter launch altitude (km)'
5      launchAlt ← USERINPUT
6      OUTPUT 'Enter burst altitude (km)'
7      burstAlt ← USERINPUT
8      IF launchAlt ≥ burstAlt THEN
9          OUTPUT 'Launch altitude must be below burst altitude'
10     ELSE
11         IF burstAlt > 35 THEN
12             OUTPUT 'Burst altitude cannot exceed 35 km safety limit'
13         ELSE
14             validMission ← True
15         ENDIF
16     ENDIF
17 UNTIL validMission = True
18 ascentDistance ← burstAlt - launchAlt
19 OUTPUT ascentDistance

The table below shows three independent tests used to check the algorithm.

Complete the table to show the values of the validMission and ascentDistance variables at the end of each independent test execution.

Test typeTest datavalidMissionascentDistance
NormallaunchAlt12
burstAlt30
ErroneouslaunchAlt40
burstAlt25
BoundarylaunchAlt10
burstAlt35
[4]
Markscheme

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms

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.

Question bank