Question 7
AQA Computer Science Specimen Paper 1B (8525/1B)GCSE10 marks
On the specification
- 7.1
- 3.2 Programming
- 7.2
- 3.2 Programming
- 7.3
- 3.2 Programming
- 7.4
- 3.1 Fundamentals of algorithms3.2 Programming
Question text
7 The algorithm in Figure 4 is a sorting algorithm. • Array indexing starts at 0. • Line numbers are included but are not part of the algorithm. Figure 4 1 arr [4, 1, 6] 2 swapsMade false 3 WHILE swapsMade = false 4 swapsMade true 5 i 0 6 WHILE i < 2 7 IF arr[i+1] < arr[i] THEN 8 t arr[i] 9 arr[i] arr[i+1] 10 arr[i+1] t 11 swapsMade false 12 ENDIF 13 i i + 1 14 ENDWHILE 15 ENDWHILE 7.1 State the data type of the variable swapsMade in the algorithm shown in Figure 4. [1 mark] 7.2 The identifier swapsMade is used in the algorithm shown in Figure 4. Explain why this is a better choice than using the identifier s. [2 marks] 7.3 Shade one lozenge to show which of the following contains the false statement about the algorithm in Figure 4. [1 mark] A The algorithm uses a named constant. B The algorithm uses indefinite iteration. C The algorithm uses nested iteration. 7.4 Complete the trace table for the algorithm shown in Figure 4. Some values have already been entered. [6 marks] arr swapsMade i t [0] [1] [2] 41 6 false