An astrophysicist is developing an algorithm to process radio telemetry data from a deep-space satellite. The telemetry is stored in a 2D array, where the first row contains the time of the reading and the second row contains the signal strength in decibels.
State what should be written in place of the labels L1 to L3 in the algorithm below to make it function correctly.
SUBROUTINE findPeakSignal(mode, totalReadings)
telemetry ← [['01:00', '05:00', '09:00', '13:00', '17:00', '21:00'],
['14', '98', '241', '12', '85', '3']]
idx ← 0
peakSignal ← -1
IF mode = 'PEAK' THEN
FOR j ← 0 TO totalReadings - 1
strength ← STRING_TO_INT(telemetry[L1][j])
IF strength > peakSignal THEN
peakSignal ← strength
idx ← L2
ENDIF
ENDFOR
ELSE
OUTPUT 'Alternative mode unavailable'
ENDIF
IF peakSignal ≠ -1 THEN
OUTPUT 'Peak of ', telemetry[1][idx], ' reached at ', telemetry[0][idx]
ENDIF
ENDSUBROUTINE
OUTPUT 'Enter operational mode (PEAK or BASE): '
selectedMode ← USERINPUT
findPeakSignal(L3, 6)
L1:
L2:
L3:
131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.