0% found this document useful (0 votes)
58 views6 pages

26 6 2024 Flowchart Qus

The document outlines algorithms for managing stock levels of bread rolls and wheelbarrows, including input handling and stock replenishment. It includes tasks such as completing trace tables for given input data and identifying potential problems with the algorithms. Additionally, it discusses methods for extending the algorithms to accommodate various sales scenarios.

Uploaded by

swamyelhtet2008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views6 pages

26 6 2024 Flowchart Qus

The document outlines algorithms for managing stock levels of bread rolls and wheelbarrows, including input handling and stock replenishment. It includes tasks such as completing trace tables for given input data and identifying potential problems with the algorithms. Additionally, it discusses methods for extending the algorithms to accommodate various sales scenarios.

Uploaded by

swamyelhtet2008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

12

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

Total Total + Sold Stock Stock + 50

© UCLES 2022 0478/21/O/N/22


13

(a) Complete the trace table for the algorithm using this input data:
24, 12, 6, 30, 12, 18, –1, 24

Sold Stock Total OUTPUT

[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]

© UCLES 2022 0478/21/O/N/22 [Turn over


10

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

Hundreds Number DIV 100

Temp Number MOD 100

Tens Temp DIV 10

Units Number MOD 10


STOP

OUTPUT "Hundreds: ",


Hundreds, " Tens: ",
Tens, " Units: ", Units

© UCLES 2022 0478/22/O/N/22


11

Complete the trace table for the algorithm using this input data:

97, 876, 4320, 606, 9875, 42, 124

Counter Number Hundreds Temp Tens Units OUTPUT

[5]

© UCLES 2022 0478/22/O/N/22 [Turn over


12

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

Total Total + 1 Stock Stock + 10

© UCLES 2022 0478/23/O/N/22


13

(a) Complete the trace table for the algorithm using this input data:

“Y”, “Y”, “Y”, “Y”, “Y”, “Y”, “N”

Stock Total Sale OUTPUT

[4]

(b) Explain how you could extend the algorithm to allow for the sale of more than one wheelbarrow
at a time.

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

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

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

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

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

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

............................................................................................................................................. [3]

© UCLES 2022 0478/23/O/N/22 [Turn over

You might also like