Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language

Q26 · 9618/12/O/N/23 Q9

Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3.

Q269618/12/O/N/23original Q9Structured · 8 marks
Question 9 from 9618/12/O/N/23

Worked solution

(a)

Name the group each opcode belongs to:

IN: input and output of data [1]

ADD: arithmetic operations [1]

JPE: unconditional and conditional instructions [1]

CMI: compare instructions [1]

(b)

The input '1' has ASCII value 49. Trace line by line, writing a value only when it changes. The first pass fails the compare (51 against 0). The loop then stores 65 in 100, so the second pass finds 65 equal and jumps to OUT.

Instruction addressACCIX100101110111Output
005165
100
1149
1249
1351
14
15
1649
1765
181
1965
20
1365
14
15
21A
22

Rows 10 to 12 correct [1]

Rows 13 to 16 correct [1]

Rows 17 to 20 correct [1]

Second pass rows 13, 14, 15, 21 and 22 correct, with output A [1]

KEY IDEAIn a trace, follow the jump back into the loop and stop when the compare is true.
TOTAL 8 marks

Official mark scheme

Mark scheme for 9618/12/O/N/23 question 9
VIDEO
▶ Starts at Q9 (1:39:53)

Starts at Q9 (1:39:53) · by Pseudocode Pro. 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.