An algorithm for a deep-space communications probe verifying its connection sequence is shown in Figure 1.
Regardless of what values are input, the same number of OUTPUT instructions will always execute when the algorithm runs.
Figure 1
1 OUTPUT 'Establishing communication link with Deep Space Network...'
2 connectionMode ← USERINPUT
3 IF connectionMode = 'high-gain' THEN
4 OUTPUT 'Configuring parabolic antenna array.'
5 signalStrength ← USERINPUT
6 IF signalStrength < 15 THEN
7 OUTPUT 'Signal low: Initiating carrier-wave amplification.'
8 OUTPUT 'Warning: Transmit latency will exceed 12 minutes.'
9 ELSE
10 OUTPUT 'Signal nominal: Locking phase-locked loop.'
11 OUTPUT 'Ready for high-bandwidth telemetry stream.'
12 ENDIF
13 ELSE
14 OUTPUT 'Initializing low-gain omnidirectional dipole.'
15 powerBudget ← USERINPUT
16 IF powerBudget = 'restricted' THEN
17 OUTPUT 'Low-power state: Disabling non-essential subsystems.'
18 OUTPUT 'Transmitting beacon packets only.'
19 ELSE
20 OUTPUT 'Standard power: Engaging multi-frequency ping.'
21 OUTPUT 'Awaiting ground station handshake.'
22 ENDIF
23 ENDIF
State how many OUTPUT instructions will execute whenever this algorithm is run.
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.