A global 2D array Result of type INTEGER is used to store a list of exam candidate numbers together with their marks. The array contains 2000 elements, organised as 1000 rows and 2 columns. Column 1 contains the candidate number and column 2 contains the mark for the corresponding candidate. All elements contain valid exam result data. A procedure Sort() is needed to sort Result into ascending order of mark using an efficient bubble sort algorithm. Write pseudocode for the procedure Sort().
- A procedure Sort() is needed to sort Result into ascending order of mark using an efficient bubble sort algorithm. Write pseudocode for the procedure Sort().[8]
Mark scheme
Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.
- [1] Outer loop
- [1] Inner loop
- [1] Correct comparison in a loop
- [1] Correct swap of col1 array elements in a loop
- [1] Correct swap of col2 array elements in a loop (via loop or separate statements)
- [1] 'NoSwap' mechanism: Conditional outer loop including flag reset
- [1] 'NoSwap' mechanism: Set flag in inner loop to indicate swap
- [1] Reducing Boundary in the outer loop
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →