Computer Science · May / June 2019 · Paper 1 HL · Question 15
Adapt for 2027Selection and bubble sort tracing and static vs dynamic structures are on the course; rewrite the IB pseudocode in Python or Java.
IBCS
As printed in the paper
The question as text
15. 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
15(a)[5]
15(b)(i)[3]
15(b)(ii)[1]
15(c)[2]
15(d)[3]
15(e)[1]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

