Note AcademyNote Academy

Computer Science (AS & A Level) · May / June 2025 · Paper 21 · Question 4

9618

As printed in the paper

The question as text

Study the algorithm: DECLARE Chars : ARRAY[1:4] OF CHAR DECLARE I, J : INTEGER DECLARE Key : CHAR I 2 Chars[1] 'D' Chars[2] 'T' Chars[3] 'H' Chars[4] 'R' WHILE I <= 4 //Outer loop Key Chars[I] J I – 1 WHILE J >= 0 AND Chars[J] > Key //Inner loop Chars[J + 1] Chars[J] J J – 1 ENDWHILE Chars[J + 1] Key I I + 1 ENDWHILE

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

Show the answer and mark scheme
  • 4(a)[2]

  • 4(b)[6]

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