0% found this document useful (0 votes)
38 views7 pages

Compiler Contruction QB PDF

This document is a question bank for the Compiler Construction subject at Shivaji University, Kolhapur, for the March 2022 examination. It includes multiple-choice questions covering various topics such as compiler tools, lexical analysis, syntax analysis, syntax-directed translation, code optimization, and code generation. Additionally, it outlines specific questions for each unit related to compiler phases, error recovery, parsing techniques, and optimization strategies.

Uploaded by

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

Compiler Contruction QB PDF

This document is a question bank for the Compiler Construction subject at Shivaji University, Kolhapur, for the March 2022 examination. It includes multiple-choice questions covering various topics such as compiler tools, lexical analysis, syntax analysis, syntax-directed translation, code optimization, and code generation. Additionally, it outlines specific questions for each unit related to compiler phases, error recovery, parsing techniques, and optimization strategies.

Uploaded by

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

Shivaji University , Kolhapur

Question Bank For Mar 2022 ( Summer ) Examination


Subject Code :81546 Subject Name : Compiler Construction

QN QUESTION TEXT OPTION1 OPTION2 OPTION3 OPTION4 ANS

Syntax
Parser Directed Scanner
1 Which of the following is not a tool used in compiler? Static Checker D
Generator Translation Generator
Engine
Optimized to
Optimize the Take less time
2 Optimizing Compiler _________. occupy less None of these B
code to execute
space
3 Silicon compilers are used in circuit design. TRUE FALSE A
_________or scanning is the process where the stream of characters
Lexical
4 making up the source program is read from left to right and grouped Diversion Modeling None of these A
analysis
into tokens.
Source
The lexical analyzer takes_________as input and produces a stream Token,source
5 program,token All of these None of these A
of_______as output. program
s

SLR parsing Canonical LR LALR parsing


6 YACC builds up ______. None of these C
table parsing table table

uses source is required to


is similar to none of the
7 The linker _________. code as its create a load C
interpreter above
input module

Regular Finite Regular


8 For specifying token _______ is used. PDA C
language Automata Expression

9 Which of the following is not a token of C program? 1.02E+02 #define MAX 123.33 B
For reading input character by character, buffering mechanism is
10 TRUE FALSE A
used.
accepts a
automates appears to
places program
the execute a
programs into written in a
translation of source
memory and high level
11 Compiler is a program that ________. assembly program as if C
prepares language and
language into it were
them for produces an
machine machine
execution object
language language
program
The grammar The grammar The grammar
For predictive parsing the grammar A->AA I (A) I ε is not suitable The grammar
12 is right is left is an operator B
because is ambiguous
recursive recursive grammar
In a compiler, the data structure responsible for the management of Semantic Abstract
13 Parser table Symbol table C
information about variables and their attributes is ______. stack syntax-tree
May be top
Top down Bottom up down or None of the
14 Shift reduce parsers are ______. B
parser parser bottom up above
parser

A grammar that produces more than one parse tree for leftmost or
15 Ambiguous Unambiguous Regular None of these A
rightmost derivation of some sentence is called ______.

In a compiler _______________ checks every character of the source The lexical syntax code code
16 A
text. analyzer analyzer generator optimizer

it never gets
it is simple to both (a) and
17 Advantage of panic mode of error recovery is that _____. into an none of these C
implement (b)
infinite loop

Ambiguous None of the


18 Synthesized attribute can be easily simulated by a _____. LL grammar LR grammar C
grammar above
The reduce The error The shift
The go to part
entries in entries in entries in
Which one of the following statement is false for the SLR (1) and LALR of both tables
19 both the both the both the C
(1) parsing tables for a context free grammar? may be
tables may be tables may be tables may be
different
different different identical
Right most Leftmost
Right most Leftmost
20 A bottom up parser generates _______. derivations in derivations in B
derivations derivations
reverse reverse

Which table is a permanent data bases that has an entry for each
21 Terminal table Literal table Identifier table Reductions A
terminal symbol?

Operator
An LALR (k) An LR (k) Recursive
22 ________ is a top-down parser precedence D
parser parser descent parser
parser
During the
During During the During the
lexical
23 In a compiler, when is the keywoards of a language are recognized? parsing of the code data flow A
analysis of a
program generation analysis
program

Postfix Three address


24 Which of the following is not an intermediate code form? Syntax trees Quadruples D
notation codes

Remove left
Left Factor Remove left
recursion and
25 To convert an arbitrary CFG to an LL (1) grammar the grammar recursion None of these C
left factor the
alone alone
grammar
Common subexpression elimination is not the code optimization
26 TRUE FALSE B
technique.

27 Which of the following system software resides in main memory? text editor assembler linker all of these D

_________ replaces an expensive operation by a cheaper one, such Reduction in


28 Code motion Compaction Induction C
as a multiplication by an addition. strength
loop local constant
29 Peephole optimization is a form of _______. none of these B
optimization optimization folding

to parse the
source
to build a
program into to build a
literal able
30 Task of the lexical analysis phase is ________. basic uniform all of these D
and an
elements or symbol table
identifier table
tokens of the
language
31 In flow graphs, nodes represent computations. TRUE FALSE A
32 In flow graphs, edges represent the flow of control. TRUE FALSE A

target source
33 The output of a code generator is a ________ . syntax tree parse tree B
program program

Comments in the source program to a computer are deleted by the lexical the semantic the code the code
34 A
_______. analysis analysis generation optimizer

behavior & behavior &


35 The quality of generated code is determined by its __________ . speed & size behavior only C
size speed
BRANCH: COMPUTER SCIENCE AND ENGINEERING
SUBJECT: COMPILER CONSTRUCTION
SUBJECT CODE: 81546

QUESTION BANK

Unit 1: Introduction to Compiling


1. Define Compilers. Explain phases of a compiler
2. Explain different following tools for which compiler technology is used to create:
a. Structure editors
b. Pretty Printers
c. Static Checkers
d. Interpreters
e. Silicon Compilers
3. Explain different compiler construction tools.
4. Explain following cousins of compiler:
a. Linker
b. Loader
c. Assembler
5. What are different types of compiler? Explain.
6. What is pass in Compilers? What is meant by analysis & synthesis phase of a compiler?
7. Explain translation of a statement using 6 phases of compiler.
8. What is difference between pass 1 & pass 2 compilers?

Unit 2: Lexical Analysis


1. Explain structure of Lexical Analyzer.
2. How error recovery is handled in lexical analysis?
3. What are tokens? Explain specification & recognition of tokens.
4. Create a lexical analyzer with LEX as tool.
5. Explain Lex specification.
6. Design a lexical analyzer generator.
7. What is input buffering? Explain with example.
8. Construct Transition Diagram for relational operator (relop)
9. Generate string for the following languages.
i) aa(a/b)*bb
ii) aa*(a/b)*bb*
iii) (aa)*abb(bb)*
10. Construct Finite Automata for following Language
i) (a/b)*abb
ii) aa*/bb*

Unit 3: Syntax Analysis


1. What is syntax analysis (parsing)? Explain structure of a parser.
2. Explain syntax errors & their recovery with the help of compilers.
3. Explain following error recovery strategies:
a. Panic Mode b. Phrase Level c. Error Productions d. Global Corrections
4. What is ambiguity in grammar? Explain with example.
5. What is precedence & associativity of operators? Explain with example.
6. What is top down parsing? Explain with example.
7. What are recursive descent parsers? Explain with example.
8. What is backtracking? Explain with example.
9. How to design non backtracking recursive descent parsers?
10. Explain non recursive predictive parsing algorithm.
11. Explain LL (1) parsing algorithm.
12. What is operator precedence parsing? Explain with example.
13. Explain SLR parsing.
14. Explain LALR parsing.
15. How to calculate FIRST & FOLLOW sets?
16. What is Left Recursion? Perform Left recursion on following grammar
EE+T/T
TT*F/F
F (E)/id
17. Check the below grammar is in LL(1) or not
SAB
Aa
Bb
18. What is Shift-Reduce Parsing Technique? Explain with Example.
19. Check the below grammar is in LR(0) or not
ET+E
ET
Ti
20. What are the conditions to check SR and RR Conflict in SLR (1) Parsing Technique?
Unit 4: Syntax Directed Translation and Intermediate Code Generation
1. What is SDD?
2. Differentiate between synthesized & inherited attributes.
3. What is S attributed definition & L attributed definition? Explain with examples.
4. Construct SDD syntax tree for expressions.
5. What is SDT? Explain top down translation for L attributed definition.
6. What is intermediate code generation?
7. Explain following:
a. Syntax tree
b. Postfix notation
c. Three address code
8. Differentiate between parse tree & syntax tree.
9. What is backpatching?
10. What is Annotated Parse Tree? Construct Annotated Parse Tree for 3*5+4 using S-Attributed
Definition.
11. Write Syntax Directed Translation Scheme for Assignment Statements.
12. Write Syntax Directed Translation Scheme for Boolean Expression.

Unit 5: Code Optimization


1. What are sources of optimization?
2. What is peephole optimization?
3. What are basic blocks?
4. What are loops in flow graphs?

Unit 6: Code Generation


1. What is code generation? Explain basic blocks & flow graphs?
2. Explain three address codes with example
3. Explain quadruples & triples with examples.
4. What are issues in design of a code generator?
5. Explain Run time storage management & next use information.
6. Explain issues in register allocation.
7. Explain code generation form DAGs.
8. Construct DAG(Directed Acyclic Graph) for following Expression
((a*b)+(a*b))+((c*d)+(c*d))

You might also like