26 6 2024 Flowchart Qus
26 6 2024 Flowchart Qus
4 This algorithm makes sure that there are enough fresh bread rolls available for customers to buy.
START
Stock 50
Total 0
INPUT Sold
Yes
IS Sold = OUTPUT Total
–1?
No
STOP
Stock Stock – Sold
Yes OUTPUT
IS Stock
< 20? "Add new stock"
No
(a) Complete the trace table for the algorithm using this input data:
24, 12, 6, 30, 12, 18, –1, 24
[4]
(b) Identify the problem that will occur if the input data starts with a value of 70.
Explain how you would correct this problem.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
6 This flowchart represents an algorithm to divide three-digit numbers into hundreds, tens and units.
The pre-defined function DIV gives the value of the result of integer division, for example
Y = 9 DIV 4 gives the value Y = 2
The pre-defined function MOD gives the value of the remainder of integer division, for example
R = 9 MOD 4 gives the value R = 1
START
Counter 0
Counter Counter + 1
Yes IS
Counter > 7?
No
INPUT
Number
IS Yes
Number < 100?
No
IS Yes
Number > 999?
No
Complete the trace table for the algorithm using this input data:
[5]
4 This algorithm makes sure that there are enough wheelbarrows in stock.
START
Stock 10
Total 0
INPUT Sale
Yes
Is Sale = OUTPUT Total
"N"?
No
STOP
Stock Stock – 1
Yes OUTPUT
Is Stock
< 5? "Add new stock"
No
(a) Complete the trace table for the algorithm using this input data:
[4]
(b) Explain how you could extend the algorithm to allow for the sale of more than one wheelbarrow
at a time.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]