Compiler Design MCQ Questions And Answers - Lexical Analysis

This section focuses on "Lexical Analysis" in Compiler Design. These Multiple Choice Questions (MCQs) should be practiced to improve the Compiler Design skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. Lexical analysis is the _______ phase of a compiler

A. first
B. second
C. third
D. fourth

View Answer

2. lexical analyzer is used to ?

A. remove whitespace
B. removing comments
C. breaks these syntaxes into a series of tokens
D. All of the above

View Answer

3. If the lexical analyzer finds a token invalid then?

A. it generates an exception
B. it generates an warning
C. it generates an error
D. reads the whole program

View Answer

4. When the lexical analyzer read the source-code, it scans the code?

A. line by line
B. word by word
C. letter by letter
D. reads the whole program

View Answer

5. Which tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern Paxson in C around 1987?


View Answer

6. The function ________ is automatically generated by the flex when it is provided with a .l file

A. flex()
B. yylex()
C. lex()
D. nnlex()

View Answer

7. In the input file, In which section Anything written in this brackets is copied directly to the file lex.yy.c?

A. Rules Section
B. Definition Section
C. User Code Section
D. None of the above

View Answer

8. The rule section is enclosed in?

A. %%
B. $$
C. %%%%
D. $$$$

View Answer

9. Which symbol table implementation is based on the property of locality of reference?

A. Linear list
B. Search tree
C. Hash Table
D. Self Organisation

View Answer

10. System program such a compiler are designed so that they are ________

A. Re-enterable
B. Non-Usable
C. Serially usable
D. None of the above

View Answer


* You must be logged in to add comment.