Note AcademyNote Academy

Computer Science · Oct / Nov 2024 · Paper 22 · Question 7

0478

As printed in the paper

The question as text

This pseudocode represents an algorithm. An input of –1 will terminate the algorithm. †‡qsrˆ‡ qv€zx ‰ Š‹Œ‡‡ˆ †‡qsrˆ‡ rz§¯w ‰ Š‹Œ‡‡ˆ †‡qsrˆ‡ }~ € ‰ Š‹Œ‡‡ˆ ˆ‡­‡rŒ Š‹­¶Œ }~ € ŠŽ }~ € •– —‚ Œ’‡‹ rz§¯w }~ € Ž˜ˆ qv€zx }~ € — ‚ Œ˜ ‚ uŒ‡­ —‚ rz§¯w rz§¯w º qv€zx ‹‡Œ qv€zx ˜¶Œ­¶Œ rz§¯w ‡‹†ŠŽ ¶‹ŒŠs }~ €  —‚

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

Show the answer and mark scheme
  • 7(a)[5]

    One mark per mark point (max five)

    Correct Value column
    Correct Count column
    Correct Answer column (down to first OUTPUT (120)) – Shaded grey
    Correct Answer column (remaining rows)
    Correct OUTPUT column

    Value

    Count

    OUTPUT

    5

    5

    4

    20

    3

    60

    2

    120

    1

    120

    120

    6

    6

    5

    30

    4

    120

    3

    360

    2

    720

    1

    720

    720

    −1

  • 7(b)[1]

    One mark for correct answer

    Example:

    It multiplies the input number by one less than itself repeatedly, until the value is 1
    It calculates the number of permutations of all the numbers up to the input value
  • 7(c)[2]

    One mark per mark point (max two)

    The program would accept the value and enter the FOR loop
    Count would keep reducing by 1 and would never reach 1, as it would already be less than 1
    There would be an endless loop

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