Cambridge O Level Computer Science 2210 · 7.7 Trace tables

Q48 · 2210/23/O/N/20 Q4

Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 6 of 8.

Q482210/23/O/N/20original Q4Structured · 6 marks
Question 4 from 2210/23/O/N/20

Worked solution

(a)

Run the flowchart for each pair of inputs. MOD gives the remainder. If Y is greater than Z use A ← Y MOD Z, otherwise A ← Z MOD Y. A = 0 gives Valid, anything else gives Invalid. The algorithm ends when Y = 0.

YZAOUTPUT
1143Invalid
620Valid
390Valid
321Invalid
260Valid
00

Y column correct [1]

Z column correct [1]

A column correct [1]

OUTPUT column correct [1]

(b)

Write two of these:

It checks if the remainder is zero when the larger number is divided by the smaller number [1]

It checks if the larger number is a multiple of the smaller number (or the smaller number is a factor of the larger) [1]

Any two of these points score.

KEY IDEATrace one row at a time: MOD gives the remainder, and a remainder of 0 means one number divides exactly into the other.
TOTAL 6 marks

Official mark scheme

Mark scheme for 2210/23/O/N/20 question 4
VIDEO
▶ Topic lesson

A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.