Question 3(d) 2022 · October-November · Paper 42 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (d)
Question 1
mark per point:
Question 6
Show text version of question
Question 3
Part (d)
Question 3
A program uses a linear queue to store up to 100 integers.
Part (d)
The following iterative pseudocode function calculates the total of all the values stored in the
queue.
FUNCTION IterativeOutput(Start: INTEGER) RETURNS INTEGER
DECLARE Total : INTEGER
Total ←0 FOR Count ← Start - 1 TO HeadPointer STEP -1
Total ← Total + Queue[Count]
NEXT Count
RETURN Total
ENDFUNCTION
Rewrite the function as a recursive function using program code.
Save your program.
Copy and paste the program code into part 3(d) in the evidence document.
Why this question appears here
98% assigned-topic match · Computational thinking and problem-solving › Recursion
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_w22_qp_42.pdf
