Pass one, pass two.

Six original Cambridge-style questions on assembly language, instruction groups and the two-pass assembler, with mark-scheme style solutions.

Original questions All questions on this page are original work, written in the Cambridge AS & A Level style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

Groups and passes.

01
Explain
[2 marks]

Describe the relationship between assembly language and machine code.

  • Assembly language uses mnemonics (and labels) in place of binary opcodes (and addresses). ✓
  • Each assembly language instruction translates into one machine code instruction (one-to-one). ✓
02
Recall
[4 marks]

Describe what happens during each pass of a two-pass assembler.

  • Pass 1: reads each line, removes comments and allocates an address to each instruction. ✓
  • Pass 1: adds labels and their addresses to the symbol table (including forward references). ✓
  • Pass 2: reads each line again, looks up the opcodes in the opcode table. ✓
  • Pass 2: replaces symbolic addresses with absolute addresses from the symbol table and generates the object code. ✓
03
Apply
[3 marks]
200         LDD FIRST
201         CMP SECOND
202         JPE SAME
203         LDM #78
204         JMP SHOW
205  SAME:   LDM #89
206  SHOW:   OUT
207         END
208  FIRST:  12
209  SECOND: 12

Complete the symbol table produced by pass 1 for this program, which starts at address 200.

  • SAME 205 and SHOW 206. ✓
  • FIRST 208. ✓
  • SECOND 209. ✓
04
Trace
[2 marks]

For the program in the previous question, state the character that is output, and explain why. (ASCII: 78 is N, 89 is Y.)

  • FIRST and SECOND both hold 12, so the compare is True and JPE jumps to SAME. ✓
  • LDM #89 loads 89, so OUT outputs Y. ✓
05
Recall
[3 marks]

Give the group to which each instruction belongs: (a) STO 300, (b) CMP #10, (c) IN.

  • (a) Data movement. ✓
  • (b) Compare. ✓
  • (c) Input and output. ✓
06
Analysis
[2 marks]

Explain why an assembler that reads the program only once could not translate the instruction JMP SHOW at address 204.

  • SHOW is a forward reference: it is defined later, at address 206. ✓
  • When line 204 is first read, the address of SHOW is not yet known, so the operand cannot be replaced by an absolute address. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.