IAE Academy

GATE 2025 CS1 Q.12: solution and answer

GATE 2025 · CS1Q.12 · 1 mark · MCQ

Which ONE of the following statements is FALSE regarding the symbol table?

  1. (A)

    Symbol table is responsible for keeping track of the scope of variables.

  2. (B)

    Symbol table can be implemented using a binary search tree.

  3. (C)

    Symbol table is not required after the parsing phase.

  4. (D)

    Symbol table is created during the lexical analysis phase.

See the question in the paper

Answer and solution

ANSWER

The false statement is (C): the symbol table is still needed after parsing.

Official answer: CSource: Official answer key, GATE 2025 CS1 (IIT Roorkee)

  1. The question asks for the FALSE statement, so check each option against the role of the symbol table.

  2. (A) True: the symbol table records each name with its scope and attributes, so scope resolution depends on it.

  3. (B) True: a symbol table is a dictionary, and a hash table, a balanced binary search tree or a linked list can all implement it.

  4. (D) True: the lexical analyser enters identifiers into the table as it finds them, so the table starts to be built during lexical analysis.

  5. (C) False: after parsing, semantic analysis needs the table for type checking and declaration checks, and code generation needs it for storage addresses and types. The table is used until the end of compilation.

  6. So the false statement is (C).

KEY IDEA

The symbol table is built early (the lexer can enter identifiers) and is consulted through semantic analysis, optimisation and code generation. It is never discarded right after parsing.

WATCH OUT FOR

Treating the symbol table as a parsing-only structure and so picking (C) as true, or doubting (D) because some compilers fill the table in the parser instead of the lexer. Here (D) is still the accepted true statement and (C) is the only clearly false one.

From the GATE 2025 CS1 paper. Every question of this paper · Download the full paper · All 8 Lexical analysis questions, with notes

More Lexical analysis questions