Note AcademyNote Academy

Computer Science (AS & A Level) · Oct / Nov 2021 · Paper 42 · Question 1

9618

As printed in the paper

The question as text

Study the following pseudocode for a recursive function. FUNCTION Unknown(BYVAL X, BYVAL Y : INTEGER) RETURNS INTEGER IF X < Y THEN OUTPUT X + Y RETURN (Unknown(X + 1, Y) * 2) ELSE IF X = Y THEN RETURN 1 ELSE OUTPUT X + Y RETURN (Unknown(X - 1, Y) DIV 2) ENDIF ENDIF ENDFUNCTION The operator DIV returns the integer value after division e.g. 13 DIV 2 would give 6

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

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

  • 1(b)(i)[3]

  • 1(b)(ii)[2]

  • 1(c)[7]

  • 1(d)(i)[1]

  • 1(d)(ii)[1]

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