The GATE Grind

GATE Compiler Design: Lexical Analysis – Previous Year Questions

6 GATE previous year questions on Lexical Analysis (Compiler Design, Computer Science) with answers and explanations, from every paper.

  1. GATE 2018 CS Q47 (2 marks, Multiple choice) – A lexical analyzer uses the following patterns to recognize three tokens T 1, T 2, and T 3 over the alphabet \a,b,c\. T 1: a?(b c)*a T 2: b?(a c)*b T…
  2. GATE 2026 CS (CS2) Q35 (1 mark, Numerical answer) – A lexical analyzer uses the following token definitions: - letter [A-Za-z] - digit [0-9] - id letter(letter digit)* - number digit+ - ws (blank tab…
  3. GATE 2026 CS (CS1) Q27 (1 mark, Multiple choice) – Consider the following C statements: Which of the following statements is/are true?
  4. GATE 2025 CS (CS1) Q12 (1 mark, Multiple choice) – Which ONE of the following statements is FALSE regarding the symbol table?
  5. GATE 2023 CS Q11 (1 mark, Multiple choice) – Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end includes phases that are independent of the…
  6. GATE 2023 CS Q19 (1 mark, Multiple choice) – Consider the following definition of a lexical token id for an identifier in a programming language, using extended regular expressions: letter →…