Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
123456789101112131415161718192021222324252627
Question 17

Select one option to show which of the following is a false statement about the algorithm in Figure 1.

Figure 1

1  CONSTANT ARRAY_SIZE ← 5
2  arr ← [12, 3, 45, 7, 19]
3  FOR i ← 1 TO ARRAY_SIZE - 1
4      key ← arr[i]
5      j ← i - 1
6      WHILE j >= 0 AND arr[j] > key
7          arr[j + 1] ← arr[j]
8          j ← j - 1
9      ENDWHILE
10     arr[j + 1] ← key
11 ENDFOR
A

The algorithm utilizes nested iteration, where an indefinite loop is nested within a definite loop.

B

The named constant ARRAY_SIZE\text{ARRAY\_SIZE}ARRAY_SIZE is used to determine the upper limit of the outer loop.

C

The algorithm sorts the array in-place, modifying the original array rather than allocating a secondary array.

D

The pseudocode represents a standard implementation of the selection sort algorithm.

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