GATE CSE 2023 Q19: ε-NFA accepting identifiers letter (letter | digit)*
- Compiler Design
- 1 mark
- MCQ
- −1/3 if wrong
Question
Consider the following definition of a lexical token id for an identifier in a programming language, using extended regular expressions:
Which one of the following Non-deterministic Finite-state Automata with -transitions accepts the set of valid identifiers? (A double-circle denotes a final state)

Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: C (official GATE 2023 final answer key)
Concept used: Thompson-style construction of an ε-NFA for concatenation, union and Kleene star.
First step: Test each automaton on short strings: the empty string, 'a1b', and '1' must be rejected, accepted and rejected respectively.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2023 CS question paper and final answer key, organised by IIT Kanpur. Question paper · Answer key
More Compiler Design PYQs
- 2026 Session 1 · Q27Classify errors in three C string declarations
- 2026 Session 1 · Q28True statements about LL(1) parsing
- 2026 Session 1 · Q42Redundant (common) subexpressions in blocks B4 and B5 of a CFG
- 2026 Session 1 · Q53Compare two SDDs for type declarations
- 2026 Session 2 · Q35Count tokens produced by a lexer for a given string
- 2026 Session 2 · Q41Shift-reduce conflicts in the LR(0) table of a grammar