Question 14
AQA Computer Science June 2023 Paper 1B (8525/1B)GCSE3 marks
On the specification
- 3.2 Programming
Question text
14 box 50 students have voted for the music genre they like best. Figure 16 shows an incomplete algorithm, represented using pseudo-code, designed to output the highest or lowest results of the vote. The programmer has used a two-dimensional array called results to store the genre and the number of votes for each genre. Parts of the algorithm are missing and have been replaced with the labels to . Figure 16 SUBROUTINE showResults(method, numberOfGenres) results [['Pop', 'Post-Punk', 'Techno', 'Metal', 'Dance'], ['7', '19', '14', '1', '9']] pos 0 high -1 IF method = 'HIGHEST' THEN FOR i 0 TO numberOfGenres - 1 Votes STRING_TO_INT(results[ ][i]) IF votes > high THEN high votes pos ENDIF ENDFOR ELSE OUTPUT 'not yet working' ENDIF IF high ≠ -1 THEN OUTPUT results[0][pos], ' with ', results[1][pos] ENDIF ENDSUBROUTINE OUTPUT 'Show the genre with the HIGHEST or LOWEST number of votes? ' method USERINPUT showResults( , 5) State what should be written in place of the labels to in the algorithm in box Figure 16. [3 marks]