GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 1.9

Conditional macro expansion

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

GATE 1997, Q1.9 1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Compiler Phases, Linking & Loading

Question 1.9, GATE 1997: What does conditional expansion in a macro processor do: runtime tests, conditional runtime expansion, recursion, or choosing statements during macro expansion?
Question 1.9, GATE 1997: What does conditional expansion in a macro processor do: runtime tests, conditional runtime expansion, recursion, or choosing statements during macro expansion?
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

The macro processor evaluates an expansion-time condition, often based on macro arguments or expansion variables, and includes or omits corresponding model statements in the generated text. This occurs while expanding the macro, before the resulting program runs. Therefore D is the matching description. Runtime conditionals instead remain as executable control flow in the expanded program; they do not decide what source text the macro processor generates.

Original paper, page 1