9618/11/M/J/21 question 3: worked solution (May/June 2021, paper 11)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3. Q17 9618/11/M/J/21 original Q3 Structured · 13 marks Worked solution (a) Write the register names in order, one for each gap: Program Counter [1] Memory Address Register [1] Memory Data Register [1] Current Instruction Register [1] Program Counter [1] (b) Run the program one instruction at a time. LDX adds the Index Register to the address, so with IX = 2 it reads address 367, and with IX = 3 it reads address 368. Blank cells mean no change. Instruction address ACC 365 366 367 368 IX Output 1 3 65 66 0 200 1 201 202 203 2 204 2 205 2 206 65 207 A 208 200 2 201 202 203 3 204 3 205 3 206 66 207 B 208 200 3 201 202 209 Rows 200 to 202 (ACC = 1, compare is False so no jump) [1] Rows 203 to 205 (ACC = 2, address 365 = 2, IX = 2) [1] Rows 206 to 208 (ACC = 65, output A ) [1] Rows 200 to 205 on the second loop (ACC = 2, then 3, address 365 = 3, IX = 3) [1] Rows 206 to 208 (ACC = 66, output B ) [1] Rows 200, 201, 202, 209 (ACC = 3, compare is True so jump to 209) [1] (c)(i) Shift every bit 2 places left and fill the right with zeros: 00110101 → 11010100. 11010100 [1] (c)(ii) Each shift right divides by 2, so 3 shifts divide by 2³ = 8. The number is divided by 8 (only the whole number part is kept) [1] KEY IDEA Trace one instruction at a time and change only the register or memory cell that instruction changes. TOTAL 13 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by qiphyedu. Tap the picture to open it on YouTube.