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

Question 2(a)(i) 2018 · October-November · Paper 22 · 7 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 CalcPoints(CardNum: STRING, Total: REAL)

Question 7

✓
RETURNS INTEGER
✓
DECLARE OldPoints : INTEGER
✓
DECLARE NewPoints : INTEGER
✓
IF Total > 100
✓
THEN
✓
OldPoints ← GetPoints(CardNum)
✓
IF OldPoints > 2000
✓
THEN
✓
NewPoints ← INT(Total * 1.2)
✓
ELSE
✓
NewPoints ← INT(Total * 1.1)
✓
ENDIF
✓
ELSE
✓
NewPoints ← 0
✓
ENDIF
✓
RETURN NewPoints
✓
ENDFUNCTION
✓
1 mark for each of the following:

Question 1

✓
Correct FUNCTION heading (as given) and end

Question 2

✓
Declaring local variables for OldPoints and NewPoints

Question 3

✓
IF...THEN...ELSE...ENDIF with Total > 100

Question 4

✓
«Newpoints set to zero if Total <= 100

Question 5

✓
Nested IF...THEN...ELSE...ENDIF with OldPoints > 2000

Question 6

✓
« with correct assignments of NewPoints

Question 7

✓
Return NewPoints for all cases
✓
9608/22
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2018
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_22.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 each

time they buy items. The number of points they collect depends on:

  • the total amount they spend
  • the number of points already collected.

The function CalcPoints() takes the card number and the total amount spent as parameters. It returns the number of new points collected. 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 OldPoints INTEGER The number of points already collected NewPoints INTEGER The number of new points collected Total REAL The amount spent Takes the card number as a parameter and returns the GetPoints() FUNCTION number of points already collected INT() FUNCTION Refer to the Appendix on page 16

START

Is YES Total > 100 ?

OldPoints NO GetPoints(CardNum)

Is NO OldPoints > 2000 ?

YES

NewPoints INT(Total * 1.2)

NewPoints 0 NewPoints INT(Total * 1.1)

RETURN NewPoints

END

Question 5

(i)

Write pseudocode for the CalcPoints() function.

Your solution should follow the flowchart as closely as possible.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[7]

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_22.pdf

Keep practising this topic