GATE / CS ARCHIVE

GATE CSE 1996 / QUESTION 1.17

Tasks of a two-pass assembler

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 1996 paper

GATE 1996, Q1.17 1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Compiler Phases, Linking & Loading

Question 1.17, GATE 1996: Assign object-code generation, adding literals to the literal table, assembly listing generation, and establishing local-symbol addresses to pass 1 or 2.
Tap to enlarge
Your answer
Answer & solution

Answer: B: 2,1,2,1 (no official key was published)

Pass 1 scans source statements, advances the location counter, records labels and collects literals. It therefore establishes local-symbol addresses and enters literals before final machine-code emission. Pass 2 uses those tables to encode instructions, resolve forward uses and produce object code; the final listing can include that generated code. Hence the listed order is 2,1,2,1. If the word resolution refers specifically to substituting a symbol address at its use, that substitution occurs in pass 2; the conventional matching here means establishing the symbol-table address in pass 1.

Original paper, page 3