The pass numbers for each of the following activities
-
object code generation
-
literals added to literal table
-
listing printed
-
address resolution of local symbols that occur in a two pass assembler
respectively are
View worked solution
Answer: B
In a standard two-pass assembler, the translation of assembly language to machine code is divided into two distinct phases (passes) to handle forward references and generate the final output efficiently:
Pass 1 Activities:
- Address Resolution of Local Symbols (iv): The assembler scans the source code, maintains a Location Counter (LC), and defines the addresses of all symbols (labels) in the Symbol Table. Thus, address resolution happens in Pass 1.
- Literals Added to Literal Table (ii): Any literal values encountered in the source code are collected and placed into a Literal Table during this initial scan. Thus, this happens in Pass 1.
Pass 2 Activities:
- Object Code Generation (i): Using the completed Symbol Table and Literal Table from Pass 1, the assembler translates the instruction mnemonics and operands into binary machine instructions (object code). Thus, this happens in Pass 2.
- Listing Printed (iii): The assembly listing (which displays the source code side-by-side with its generated object code and memory addresses) can only be printed once the object code is fully generated. Thus, this happens in Pass 2.
Mapping the activities to their respective pass numbers:
- Object code generation → 2
- Literals added to literal table → 1
- Listing printed → 2
- Address resolution of local symbols → 1
The resulting sequence of pass numbers is , which corresponds to Option B.
Free practice · Your answers on this page are not saved.
