Past-paper question · 2018 October-November · Paper 21 · Q2(b)(i)

Question 2(b)(i) 2018 · October-November · Paper 21 · 2 marks

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

Official answer for Question 2

Part (b)

(i)

✓
Name: Syntax

Question 2

✓
Description: Rules of programming language have not been followed
✓
Name: Logic
✓
Description: Where the program does not behave as expected / does not give the
✓
expected result / an error in the logic of the algorithm
✓
1mark for name + 1 mark for corresponding description

Mark scheme 9608_w18_ms_21.pdf →

Show text version of question

Question 2

Part (b)

(i)

Question 2

Shop customers have a discount card with a unique card number. Customers collect points after

they have bought items. The more points they have, the bigger the discount. If they shop on a Wednesday, their discount is increased by 20%.

The function GetDiscountRate() takes a card number as a parameter and returns the discount rate for a customer based on the number of points they have collected. A flowchart for the function is shown.

The function uses the following variables and functions.

Identifier Data type Description DRate REAL The discount rate CardNum STRING The unique customer card number Points INTEGER The number of points collected Takes the card number as a parameter and returns the GetPoints() FUNCTION number of points already collected Today() FUNCTION Returns the day number: 1 for Monday, 2 for Tuesday etc.

START

DRate 0

Points GetPoints(CardNum)

Is YES Points > 199 ? DRate 0.2

NO

Is YES Points > 99 ? DRate 0.1

NO

Is Today = YES DRate DRate * 1.2 Wednesday ?

NO

RETURN DRate

END

Question 5

A
programmer writes the function GetDiscountRate() in a high-level language.

(i)

A run-time error could occur when the function is used.

Name and describe one other type of error that the function could contain.

Name .................................................................................................................................

Description ........................................................................................................................

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

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

[2]
Topic relevance

Why this question appears here

82% assigned-topic match · Data types and structures › Data types and records

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

Keep practising this topic