Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122
Question 7

A programmer is writing a sorting algorithm to sort high scores in descending order.

Figure 1

1  CONSTANT MAX_ITEMS ← 4
2  scores ← [12, 45, 23, 8]
3  swapped ← true
4  WHILE swapped = true
5      swapped ← false
6      FOR i ← 0 TO MAX_ITEMS - 2
7          IF scores[i] < scores[i+1] THEN
8              temp ← scores[i]
9              scores[i] ← scores[i+1]
10             scores[i+1] ← temp
11             swapped ← true
12         ENDIF
13     ENDFOR
14 ENDWHILE

Identify the option that contains the false statement about the algorithm in Figure 1.

A

The algorithm sorts the array in ascending order.

B

The algorithm uses definite iteration.

C

The algorithm uses a named constant.

D

The algorithm uses nested iteration.

Markscheme

Sorting algorithms Questions

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

52 exam-style questions on AQA GCSE Computer Science Sorting algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank