Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122
Question 7
Easy

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.

The algorithm sorts the array in ascending order.

The algorithm uses definite iteration.

The algorithm uses a named constant.

The algorithm uses nested iteration.

Sorting algorithms Questions

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