51Easy
0/1

An algorithm is represented by the following pseudo-code, which processes a series of altitude measurements (in metres) recorded by an autonomous drone:

1  altitudes[0] ← 340.5
2  altitudes[1] ← 512.0
3  altitudes[2] ← 128.3
4  altitudes[3] ← 410.1
5  FOR p ← 0 TO 2
6      FOR q ← 0 TO 2
7          IF altitudes[q] < altitudes[q + 1] THEN
8              temp ← altitudes[q]
9              altitudes[q] ← altitudes[q + 1]
10             altitudes[q + 1] ← temp
11         ENDIF
12     ENDFOR
13 ENDFOR

State the purpose of this algorithm.

[1]

Sorting algorithms Questions

Practise AQA GCSE Computer Science Sorting algorithms with exam-style questions for GCSE Computer Science. 62 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Sorting algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Sorting algorithms