Cambridge A2 Level Computer Science 9618 · 20.1 Programming Paradigms

Q5 · 9618/31/M/J/22 Q9

Worked solution from the Further Programming Paper 3 Advanced Theory booklet, Part 1 of 2.

Q59618/31/M/J/22original Q9Structured · 10 marks
Question 9 from 9618/31/M/J/22

Worked solution

(a)

LDM loads the number itself. LDD uses the address as given. LDI uses the address stored at that address.

InstructionAddressing modeContents of ACC
LDM #500Immediate500
LDD 500Direct100
LDI 500Indirect20

LDM #500: Immediate and 500 [1]

LDD 500: Direct and 100 [1]

LDI 500: Indirect and 20, because address 500 holds 100 and address 100 holds 20 [1]

(b)

Load 20 and store it in a labelled location. Then use LDI to load the value whose address is held in Y, add 20 and store in Z. Data locations go after the program code.

      LDM  #20
      STO  Twenty
      LDI  Y
      ADD  Twenty
      STO  Z
Twenty: #20
Y:
Z:

LDM #20 is seen [1]

The value 20 is stored at an address (STO Twenty) [1]

That address is labelled (for example Twenty:) away from the program code [1]

Addresses labelled Y: and Z: away from the program code [1]

Correct use of LDI Y [1]

Correct use of STO Z [1]

Correct use of ADD with the labelled address of 20 [1]

Any suitable label name is fine.

KEY IDEAImmediate uses the number itself, direct uses the address given, and indirect follows the address stored at that address.
TOTAL 10 marks

Official mark scheme

Mark scheme for 9618/31/M/J/22 question 9
VIDEO
▶ Whole paper

Video solution of the whole paper · by qiphyedu. 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.