Assemblers and macros: An instruction in a programming language that is replaced by a sequence of instructions before assembly or compilation is called what?

Difficulty: Easy

Correct Answer: macro

Explanation:


Introduction / Context:
Macro facilities allow programmers to define templates that expand into multiple instructions or declarations, improving readability and reducing repetition. Macro processing happens before actual assembly or compilation.



Given Data / Assumptions:

  • There exists a pre-assembly/compilation expansion step.
  • The original single directive expands into several low-level instructions.
  • We are distinguishing macros from procedures and other symbols.


Concept / Approach:

A macro is a named pattern with parameters that the preprocessor or assembler expands inline. Unlike procedures (which are called at runtime), macros generate code at compile time, in place, avoiding call overhead but increasing code size.



Step-by-Step Solution:

Identify pre-assembly/compile-time expansion behavior.Match to macro definition (textual or syntactic expansion).Exclude runtime constructs (procedures) and non-expanding symbols (labels, literals).


Verification / Alternative check:

Assembler directives like MACRO/ENDM and C/C++ preprocessor macros (#define) exemplify compile-time expansion into instruction sequences.



Why Other Options Are Wrong:

  • Procedure name: Invoked at runtime, not expanded inline by default.
  • Label: A position marker for control flow or data, no expansion.
  • Literal: A constant value embedded in code, no expansion.
  • None of the above: Incorrect because macro is correct.


Common Pitfalls:

Confusing macros with inline functions; both eliminate call overhead, but macros are textual expansions and lack type checking in many languages.



Final Answer:

macro

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion