# Questions & Answers of Lexical analysis

## Weightage of Lexical analysis

Total 6 Questions have been asked from Lexical analysis topic of Compiler Design subject in previous GATE papers. Average marks 1.33.

A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}.

Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix.

If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?

Match the following:

 (P) Lexical analysis (i) Leftmost derivation (Q) Top down parsing (ii) Type checking (R) Semantic analysis (iii) Regular expressions (S) Runtime environments (iv) Activation records

Match the following:

 P. Lexical analysis Q. Parsing R. Register allocation S. Expression evaluation 1.   Graph coloring    2.   DFA minimization    3.   Post-order traversal    4.   Production tree

In a compiler, keywords of a language are recognized during

Which data structure in a compiler is used for managing information about variables and their attributes?

I.  There exist parsing algorithms for some programming languages whose complexities are less than $\mathrm{\theta }$(n3).