Note AcademyNote Academy

Computer Science · May / June 2019 · Paper 1 SL · Question 16

Adapt for 2027Tracing selection sort, reading a bubble sort flowchart and using sub-programs are on the syllabus, but the pseudocode must be written in Python or Java.

IBCS

As printed in the paper

The question as text

16. A school teacher decides to write a program to store class records and marks. Part of this program involves using a sort algorithm. The algorithm shown is a selection sort and to test it, the teacher has set up an array VALUES[] with 5 elements of test data. LIMIT = 4 loop COUNTER1 from 0 to LIMIT – 1 MINIMUM = COUNTER1 loop COUNTER2 from COUNTER1 + 1 to LIMIT if VALUES[COUNTER2] < VALUES[MINIMUM] then MINIMUM = COUNTER2 end if end loop if MINIMUM ≠ COUNTER1 then TEMPORARY = VALUES[MINIMUM] VALUES[MINIMUM] = VALUES[COUNTER1] VALUES[COUNTER1] = TEMPORARY end if end loop

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme
  • 16(a)[1]

  • 16(b)[5]

  • 16(c)(i)[3]

  • 16(c)(ii)[1]

  • 16(d)[2]

  • 16(e)[3]

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.