Question 2(a)(i) 2018 · October-November · Paper 23 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
(i)
Question 5
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Show text version of question
Question 2
Part (a)
(i)
Question 2
Shop customers have a discount card with a unique card number. Customers collect points when
they buy items. At the end of each year, customers are given bonus (extra) points related to the total amount they have spent during the year, and the number of points they have on their card.
The function CalcBonus() takes the card number as a parameter. It returns the bonus points for the customer. A flowchart for the function is shown.
The function uses the following variables and functions.
Identifier Data type Description CardNum STRING A numeric string representing the unique card number Points INTEGER The number of points collected Spend REAL The total amount that customer has spent during the year Bonus INTEGER The number of bonus points Takes the card number as a parameter and returns the GetPoints() FUNCTION number of points already collected Takes the card number as a parameter and returns the GetSpend() FUNCTION total amount that customer has spent during the year
START
Points GetPoints(CardNum)
Spend GetSpend(CardNum)
Is YES Points > 2000 ?
NO
Is YES Spend > 1000 ?
NO
Bonus 10 Bonus 50 Bonus 100
RETURN Bonus
END
Question 5
(i)
Write pseudocode for the CalcBonus() function.
Your solution should follow the flowchart for the function as closely as possible.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[5]
Question 6
Why this question appears here
71% assigned-topic match · Algorithm design and problem-solving › Algorithms
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 9608_w18_qp_23.pdf
