Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
123456789101112131415161718192021222324252627
Question 14

An algorithm is shown in Figure 1.

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

Which of the following contains the false statement about the algorithm in Figure 1?

A

The algorithm uses nested iteration.

B

The algorithm sorts the list in descending numerical order.

C

The algorithm uses only definite iteration.

D

The algorithm uses selection to decide whether to swap elements.

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