Note AcademyNote Academy

Computer Science · Oct / Nov 2016 · Paper 23 · Question 3

2210

As printed in the paper

The question as text

The flowchart below inputs the price of an item under $10. The change from a $10 note is output. Any amount less than 5 cents is rounded up to 5 cents. The predefined function INT rounds a number down to the nearest whole number; for example Z ← INT(5.7) gives the value Z = 5 START INPUT Price Is Change >= 1? Yes Yes No No No Yes Change 10 – Price END OUTPUT TenCents, " ten cent coins" Is Change >= 0.5? Is Change*10 – TenCents > 0? Dollars INT(Change) Change Change – 0.5 Change Change – INT(Change) TenCents INT(Change * 10 + 0.5) OUTPUT Dollars, " dollars" OUTPUT "One 50 cent coin" OUTPUT "One 5 cent coin" 9 Complete the trace table for the input data: 6.29 Price Change Dollars TenCents OUTPUT [5]

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

Price Change Dollars TenCents OUTPUT 6.29 3.71 0.71 3 dollars 0.21 One 50 cent coin 2 2 ten cent coins One 5 cent coin (1 mark per correct column) [5]

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.