State what should be written in place of the labels L1, L2, and L3 in the algorithm in Figure 1.
SUBROUTINE findBest(criterion, numSubjects)
records ← [['Maths', 'English', 'Science', 'History', 'Art'],
['84', '92', '76', '61', '89']]
pos ← 0
maxScore ← -1
IF criterion = 'MAX' THEN
FOR j ← 0 TO numSubjects - 1
score ← STRING_TO_INT(records[L1][j])
IF score > maxScore THEN
maxScore ← score
pos ← L2
ENDIF
ENDFOR
ELSE
OUTPUT 'Not implemented'
ENDIF
IF maxScore ≠ -1 THEN
OUTPUT records[0][pos], ' with ', records[1][pos]
ENDIF
ENDSUBROUTINE
OUTPUT 'Search for MAX or MIN score? '
userChoice ← USERINPUT
findBest(L3, 5)
Figure 1
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.