0% found this document useful (0 votes)
15 views

Compiler Design

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Compiler Design

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

HAINDAVI DEGREE & PG COLLEGE

INTERNAL ASSESSMENT-Ⅰ

SEMESTER-Ⅲ

Paper-Ⅱ

Group: M.Sc. (computer science)-Ⅱ year Max.Marks:10

Sub: Compiler Design Hall Ticket No:

Name:

SECTION-A

1
Ⅰ choose the correct answer 10 × =5M
2

1.Which phase of a compiler involves breaking down the source code into tokens?

a) Syntax analysis b) Semantic analysis [ ]

c) Lexical analysis d) Code optimization

2.What is the role of a lexical analyzer in a compiler? [ ]

a) Checking syntax errors b) Converting tokens to intermediate code

c) Identifying tokens in the source code d) Generating assembly code

3.A context-free grammar is used in which phase of a compiler? [ ]

a) Lexical analysis b) Syntax analysis

c) Code generation d) Code optimization

4.Which of the following data structures is commonly used in lexical analysis? [ ]

a) Abstract syntax tree b) Transition tables c) Stack d) Binary search tree

5.In top-down parsing, which parsing method uses backtracking? [ ]

a) Recursive-descent parsing b) Predictive parsing

c) LL(1) parsing d) Bottom-up parsing


6.Which grammar type does predictive parsing work with? [ ]

a) LL(1) grammars b) Ambiguous grammars

c) LR(1) grammars d) Context-sensitive grammars

7.What is the output of the lexical analysis phase? [ ]

a) Parse tree b) Tokens c) Abstract syntax tree d) Machine code

8.The process of associating each token with its corresponding pattern is called: [ ]

a) Parsing b) Tokenization c) Syntax analysis d) Translation

9.Which tool is used to generate lexical analyzers? [ ]

a) YACC b) LEX c) Bison d) ANTLR

10.Recursive-descent parsing is an example of: [ ]

a) Bottom-up parsing b) Top-down parsing

c) Syntax-directed translation d) Code generation

SECTION-B

1
Fill in the Blanks 10 ×
2
=5M

1. The __________ phase of a compiler translates source code into tokens.


2. __________ parsers are used in top-down parsing without backtracking.
3. Context-free grammars are represented using __________ rules.
4. Lexical analyzers identify __________ in the input source code.
5. __________ parsing uses a lookahead symbol to decide which rule to apply.
6. A __________ is a sequence of characters that matches a pattern in lexical analysis.
7. The __________ tool is commonly used to generate lexical analyzers.
8. LL(1) grammars must be __________ to avoid ambiguity.
9. The predictive parsing table is constructed based on __________ and __________ sets.
10. The input to a lexical analyzer is a __________ file.

You might also like