The GATE Grind

GATE Compiler Design: Lexical Analysis – Previous Year Questions

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

11 questions worth 12 marks in all (10 1-mark, 1 2-mark). Asked between 2010 and 2026, so you can see how the topic has been tested over time.

  1. GATE 2010 CS Q23 (1 mark, Multiple choice) – Which compiler structure manages information about variables and their attributes?
  2. GATE 2011 CS Q11 (1 mark, Multiple choice) – A compiler recognizes language keywords during
  3. GATE 2011 CS Q29 (1 mark, Multiple choice) – Which machine model is necessary and sufficient for lexical analysis of a modern language such as Java?
  4. GATE 2017 CS (CS2) Q15 (1 mark, Multiple choice) – Match compiler inputs P: syntax tree, Q: character stream, R: intermediate representation, S: token stream, to phases (i) code generator, (ii) syntax…
  5. GATE 2016 CS (CS2) Q29 (1 mark, Multiple choice) – Match P: lexical analysis; Q: top-down parsing; R: semantic analysis; S: runtime environments, with (i) leftmost derivation, (ii) type checking, (iii)…
  6. 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…
  7. 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…
  8. GATE 2026 CS (CS1) Q27 (1 mark, Multiple choice) – Consider the following C statements: Which of the following statements is/are true?
  9. GATE 2025 CS (CS1) Q12 (1 mark, Multiple choice) – Which ONE of the following statements is FALSE regarding the symbol table?
  10. 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…
  11. 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 →…