Skip to content

GATE CS Lexical Analysis questions

Practise Lexical Analysis questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2026Compiler DesignLexical AnalysisMCQ · 1 mark
Consider the following C statements: char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */ Which of the following options is/are correct?
Official PYQ2026Compiler DesignLexical AnalysisNAT · 1 mark
A lexical analyzer uses the following token definitions letter→[A−Za−z]{letter → [A-Za-z]} digit→[0−9]{digit → [0-9]} id→letter(letter∣digit)∗{id → letter (letter | digit)^*} number→digit{number → digit} +{ }^{+} ws→(blank∣tab∣newline){ws → (blank | tab| newline)} +{ }^{+} For the string given below, …
Official PYQ2025Compiler DesignLexical AnalysisMCQ · 1 mark
Which ONE of the following statements is FALSE regarding the symbol table?
Official PYQ2024Compiler DesignLexical AnalysisMCQ · 1 mark
​​​Consider the following two sets: …
Official PYQ2023Compiler DesignLexical AnalysisMCQ · 1 mark
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 target hardware. S2: The back-end includes phases that are specific to the target hardware. S3: The back-end includes phases that are specific to the programming language used in the source code. Identify the …
Official PYQ2021Compiler DesignLexical AnalysisMCQ · 1 mark
Consider the following ANSI C\text{ANSI C} program: int main () { Integer x; return 0; } Which one of the following phases in a seven-phase CC compiler will throw an error?
Official PYQ2018Compiler DesignLexical AnalysisMCQ · 2 marks
A lexical analyzer uses the following patterns to recognize three tokens T1,T2T_1, T_2, and T3T_3 over the alphabet {a,b,c}\{a, b, c\}. T1:a?(b∣c)∗aT_1: a?(b \mid c)^\ast a T2:b?(a∣c)∗bT_2: b?(a \mid c)^\ast b T3:c?(b∣a)∗cT_3: c?(b \mid a)^\ast c Note that ‘x?x?’ means 00 or 11 occurrence of the symbol x.x. Note also that the analyzer outputs the token that matches the …
Official PYQ2018Compiler DesignLexical AnalysisMCQ · 1 mark
Which one of the following statements is FALSE?
Official PYQ2017Compiler DesignLexical AnalysisMCQ · 1 mark
Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it: …
Official PYQ2015Compiler DesignLexical AnalysisMCQ · 1 mark
Match the following: …
Official PYQ2011Compiler DesignLexical AnalysisMCQ · 1 mark
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
Official PYQ2011Compiler DesignLexical AnalysisMCQ · 1 mark
In a compiler, keywords of a language are recognized during
Official PYQ2010Compiler DesignLexical AnalysisMCQ · 1 mark
Which data structure in a compiler is used for managing information about variables and their attributes?
Official PYQ2009Compiler DesignLexical AnalysisMCQ · 1 mark
Match all items in Group 1 with the correct options from those given in Group 2. …
Official PYQ2000Compiler DesignLexical AnalysisMCQ · 1 mark
The number of tokens in the following C statement is printf("i=%d, &i=%x", i, &i);
Official PYQ1997Compiler DesignLexical AnalysisMCQ · 1 mark
The conditional expansion facility of macro processor is provided to
Official PYQ1996Compiler DesignLexical AnalysisMCQ · 1 mark
Which of the following macros can put a macro assembler into an infinite loop? .MACRO M1, X .IF EQ, X ;if X=0 then M1 X + 1 .ENDC .IF NE, X ;if X ≠ O then .WORD X ;address (X) is stored here .ENDC .ENDM .MACRO M2, X .IF EQ, X M2 X .ENDC .IF NE, X .WORD X + 1 .ENDC .ENDM
Official PYQ1996Compiler DesignLexical AnalysisMCQ · 1 mark
The pass numbers for each of the following activities object code generation literals added to literal table listing printed address resolution of local symbols that occur in a two pass assembler respectively are
Official PYQ1995Compiler DesignLexical AnalysisMCQ · 1 mark
What are xx and yy in the following macro definition? macro Add x, y Load y Mul x Store y end macro
Official PYQ1994Compiler DesignLexical AnalysisNAT · 1 mark
State whether the following statements are True or False with reasons for your answer A symbol declared as ‘external’ in an assembly language program is assigned an address outside the program by the assembler itself.