Skip to main content

GATE CSE 2020Compiler Design › Runtime Environments & Parameter PassingVerified

GATE CSE 2020 PYQ: Consider the following statements. Symbol table is accessed only during lexical analysis and syntax…

Consider the following statements.

  1. Symbol table is accessed only during lexical analysis and syntax analysis.
  2. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
  3. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.

  Which of the above statements is/are TRUE?

  1. A
    I only
  2. B
    I and III only
  3. C
    Ⅱ only
  4. D
    None of  Ⅰ, Ⅱ and  Ⅲ
    Correct answer

Answer

(D) None of Ⅰ, Ⅱ and Ⅲ

Approach

Evaluate each of the three given statements independently as a claim about compiler phases: (I) the set of phases that touch the symbol table, (II) the runtime storage required to support recursion, and (III) the compiler phase responsible for the 'declared before use' rule. Mark a statement TRUE only if it is true as stated; the correct option is determined by which statements survive.

All three statements are false: the symbol table is used in later phases, recursion requires a stack not heap, and 'declared before use' is enforced during semantic analysis. Therefore, the correct answer is D.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.