Past-paper question · 2009 October-November · Paper 12 · Q8

Question 8 2009 · October-November · Paper 12 · 9 marks

Original past-paper question for 8
Original past-paper question for 8
Original past-paper question for 8
Original past-paper question for 8
Reveal official mark-scheme answer Official mark-scheme answer for 8

Official answer for Question 8

✓
INPUT NO_OF_SNACK
✓
LET PRICE = ARRAY (NO_OF_SNACK)
✓
OUTPUT PRICE
✓
REPEAT
✓
INPUT COIN
✓
IF COIN = 1 THEN PRICE = PRICE-1
✓
ELSE PRICE = PRICE -5
✓
ENDIF
✓
OUTPUT PRICE
✓
UNTIL PRICE < = 0
✓
DISPENSE PRODUCT
✓
IF PRICE < 0 THEN REPEAT
✓
DISPENSE 1 CENT COIN
✓
PRICE = PRICE + 1
✓
UNTIL PRICE = 0
✓
ENDIF
✓
END
✓
Mark Points:
  • Input snack number
  • Find price in array
  • Output Price (here AND in the first Repeat loop)
  • REPEAT... UNTIL PRICE < = 0 (or equivalent if a flow diagram Not a For)
  • Input coin (inside loop)
  • Condition of coin and then calculate price
  • Dispense Product
  • Condition for negative price
  • Loop to give change with correct condition
  • Only give 1 cent coins in change
  • Correct layout and end conditions
✓
(1 per -, max 9)
[9]

Mark scheme 9691_w09_ms_12.pdf →

Show text version of question

Question 8

Candidates are advised to use either pseudo code or a flow diagram to answer this question, although other forms of algorithmic representation will be credited.

The automated snack bar is a machine.

The machine advertises 10 snack items; each one is given a number from 0 to 9.

The user presses one of the buttons from 0 to 9 on the front of the machine. The machine checks in an array in its memory to find the price of the snack selected. This price is displayed on the front of the machine.

The customer then inserts 1-cent and/or 5-cent coins. Each time a coin is input the machine subtracts the value from the amount still required. The display changes to show the new amount still required.

When enough coins have been inserted the machine will deliver the item and pay out any change necessary.

Write an algorithm to control the process of buying a snack.

[9]

Question 6

Question 7

Question 8

reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.

University of Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.

Topic relevance

Why this question appears here

71% assigned-topic match · Hardware › Logic gates and logic circuits

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 9691_w09_qp_12.pdf

Keep practising this topic