Note AcademyNote Academy

Computer Science · Oct / Nov 2022 · Paper 22 · Question 6

0478

As printed in the paper

The question as text

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 IS Counter > 7? STOP Yes No INPUT Number OUTPUT "Hundreds: ", Hundreds, " Tens: ", Tens, " Units: ", Units Counter 0 IS Number < 100? Yes No IS Number > 999? Yes No Counter Counter + 1 Hundreds Number DIV 100 Temp Number MOD 100 Tens Temp DIV 10 Units Number MOD 10 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]

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

Show the answer and mark scheme

One mark per mark point, max five

MP1

correct Counter and Number columns

MP2

correct Hundreds column

MP3

correct Temp and Tens columns

MP4

correct Units column

MP5

correct OUTPUT column

Counter Number Hundreds

Temp

Tens

Units

OUTPUT

0

1

97

2

876

8

76

7

6

Hundreds: 8 Tens: 7

Units: 6

3

4320

4

606

6

6

0

6

Hundreds: 6 Tens: 0

Units: 6

5

9875

6

42

7

124

1

24

2

4

Hundreds: 1 Tens: 2

Units: 4

8

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