Note AcademyNote Academy

Computer Science · May / June 2026 · Paper 21 · Question 4

0478

As printed in the paper

The question as text

The following pseudocode algorithm uses a bubble sort to sort the array |š‘ˆ£¤™¥¦ Complete the algorithm. §š£¨ ›©{‚ ª«šŒ ¬› ‰ ‚ §š£¨ ­ ‰ ~¬ |š‘ˆ£¤~®ˆ¯¦ u |š‘ˆ£¤~®ˆ¯ x ‰¦ ‚°| ‚ˆ‘Œ |š‘ˆ£¤~®ˆ¯¦ |š‘ˆ£¤~®ˆ¯¦ |š‘ˆ£¤~®ˆ¯ x ‰¦ |š‘ˆ£¤~®ˆ¯ x ‰¦ ‚ˆ‘Œ ª«šŒ ‚›œ |}~¬ |±‚ ~®ˆ¯ §š£¨ §š£¨ ­ ‰ œ|‚~§ ª«šŒ › §š£¨ w ‰ [4]

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

Show the answer and mark scheme

One mark for each correct completion

Last ← __50____

REPEAT

Swap ← __FALSE___

FOR __Index___ ← 1 TO Last - 1

IF Names[Index] > Names[Index + 1]

THEN

Temp ← Names[Index]

Names[Index] ← Names[Index + 1]

Names[Index + 1] ← Temp

Swap ← TRUE

ENDIF

NEXT Index

Last ← Last - 1

UNTIL __NOT // False =__ Swap OR Last = 1

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