Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
123456789101112131415161718192021222324252627
Question 23

An algorithm is shown below.

1  readings ← [3.8, 1.2, 4.5, 0.9, 2.7]
2  n ← 5
3  FOR pass ← 0 TO n - 2
4      FOR idx ← 0 TO n - pass - 2
5          IF readings[idx] > readings[idx+1] THEN
6              temp ← readings[idx]
7              readings[idx] ← readings[idx+1]
8              readings[idx+1] ← temp
9          ENDIF
10     ENDFOR
11 ENDFOR

Which of the following contains the false statement about the algorithm?

A

The algorithm uses only nested definite iteration.

B

The algorithm sorts the list in ascending numerical order.

C

The value of readings[4] after the first complete pass of the outer loop (pass = 0) is 4.54.54.5.

D

The total number of comparisons made during the execution of the algorithm is 15.

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