Skip to main content

GATE CSE 2018Compiler Design › Lexical Analysis, Compilation Phases & LinkingVerified

GATE CSE 2018 PYQ: Which one of the following statements is FALSE?

Which one of the following statements is FALSE?

  1. A
    Context-free grammar can be used to specify both lexical and syntax rules
  2. B
    Type checking is done before parsing
    Correct answer
  3. C
    High-level language programs can be translated to different Intermediate Representations
  4. D
    Arguments to a function can be passed using the program stack

Answer

(B) Type checking is done before parsing

Approach

This is a 'which statement is FALSE' question from compiler design. Evaluate each statement against the standard phases of compilation: lexical analysis, syntax analysis (parsing), semantic analysis (type checking), intermediate code generation, code optimization, and code generation. The statement contradicting the correct ordering of these phases is the answer.

Type checking is a semantic-analysis activity that depends on the parse tree; it therefore happens after parsing, making statement B the false statement. The dominant community answer (weight 0.8) agrees, and the two lower-weight answers reinforce the same reasoning.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.