Note AcademyNote Academy

Computer Science · Oct / Nov 2023 · Paper 21 · Question 6

0478

As printed in the paper

The question as text

An algorithm has been written in pseudocode. 01 DECLARE A[1:10] : STRING 02 DECLARE T : STRING 03 DECLARE C, L : INTEGER 04 L 10 05 FOR C 1 TO L 06 OUTPUT "Please enter name " 07 INPUT A[C] 08 NEXT C 09 FOR C 1 TO L 10 FOR L 1 TO 9 11 IF A[L] > A[L + 1] 12 THEN 13 T A[L] 14 A[L] A[L + 1] 15 A[L + 1] T 16 ENDIF 17 NEXT L 18 NEXT C 19 FOR C 1 TO L 20 OUTPUT "Name ", C, " is ", A[C] 21 NEXT C

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

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

    Displaying/sort 10 names in alphabetical order 9

  • 6(b)[4]

    One mark for each point (max four)

    Initialisation
    inputting 10 names
    storing the names in an array
    sorting the names in alphabetical order using a bubble sort
    displaying the 10 names
    iteration
  • 6(c)[3]

    One mark for a meaningful identifier for the array

    A Names // ArrayNames

    Two marks for 3 meaningful identifiers for variables

    One marks for 1 or 2 meaningful identifiers for variables

    T Temp

    C Counter

    L Length

  • 6(d)[2]

    One mark for each point (max two)

    use of comments
    use of procedures/functions
    use of white space

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