Question 8 2009 · October-November · Paper 12 · 9 marks
Reveal official mark-scheme answer
Official answer for Question 8
- 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
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.
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.
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
