Past-paper question · 2018 October-November · Paper 23 · Q2(a)(i)

Question 2(a)(i) 2018 · October-November · Paper 23 · 5 marks

Original past-paper question for 2(A)(I)
Original past-paper question for 2(A)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 2(A)(I)

Official answer for Question 2

Part (a)

(i)

✓
FUNCTION CalcBonus(CardNum: STRING) RETURNS INTEGER

Question 5

✓
DECLARE Points : INTEGER
✓
DECLARE Bonus : INTEGER
✓
DECLARE Spend : REAL
✓
Points ← GetPoints(CardNum)
✓
Spend ← GetSpend(CardNum)
✓
IF Points > 2000
✓
THEN
✓
Bonus ← 100
✓
ELSE
✓
IF Spend > 1000
✓
THEN
✓
Bonus ← 50
✓
ELSE
✓
Bonus ← 10
✓
ENDIF
✓
ENDIF
✓
RETURN Bonus
✓
ENDFUNCTION
✓
1 mark for each of the following up to max 5 marks:

Question 1

✓
Function heading (inc parameters) and ending

Question 2

✓
Declaring local variables and two function calls as above

Question 3

✓
IF…THEN…ELSE…ENDIF with Points > 2000

Question 4

✓
(Nested) IF«THEN…ELSE with Spend > 1000

Question 5

✓
« assignment of Bonus to 10, 50 100

Question 6

✓
Return parameter
✓
9608/23
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2018
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_23.pdf →

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

Topic relevance

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

Keep practising this topic