Question 9
AQA Computer Science June 2022 Paper 1A (8525/1A)GCSE5 marks
On the specification
- 9.1
- 3.2 Programming
- 9.2
- 3.2 Programming
- 9.3
- 3.2 Programming
- 9.4
- 3.2 Programming
Question text
9 Figure 8 shows an algorithm represented using pseudo-code. box • Line numbers are included but are not part of the algorithm. Figure 8 1 names ['Lily', 'Thomas'] 2 name1 'Sarah' 3 name2 'Freddie' 4 OUTPUT name1[0] 5 OUTPUT LEN(names) 6 var SUBSTRING(0, 3, name1) 7 OUTPUT var SUBSTRING returns part of a string. For example, SUBSTRING(3, 5, 'programming') will return the string 'gra'. 9.1 Shade one lozenge which shows the output of line 4 from the algorithm shown in Figure 8. [1 mark] A F B Freddie C Lily D S E Sarah 9.2 box Shade one lozenge which shows the output of line 5 from the algorithm shown in Figure 8. [1 mark] A 1 B 2 C 4 D 5 E 10 9.3 State the output of line 7 from the algorithm shown in Figure 8. [1 mark] 9.4 Two extra lines are being added to the end of the algorithm in Figure 8. Fill in the gaps so the output from the new final line will be the string 'Thomasrah'. [2 marks] var SUBSTRING( , , name1) OUTPUT names[ ] + var 12