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

CC QB

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 and descriptive questions covering various topics such as compiler phases, lexical analysis, syntax analysis, syntax-directed translation, code optimization, and code generation. The document serves as a study guide for students preparing for their exams in this subject.

Uploaded by

durukadam01
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)
37 views7 pages

CC QB

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 and descriptive questions covering various topics such as compiler phases, lexical analysis, syntax analysis, syntax-directed translation, code optimization, and code generation. The document serves as a study guide for students preparing for their exams in this subject.

Uploaded by

durukadam01
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
appears to
automates the program
places execute a
translation of written in a
programs into source
assembly high level
11 Compiler is a program that ________. memory and program as if C
language into language and
prepares them it were
machine produces an
for execution machine
language object
language
program

12 Can Lex be used to recognize any language? Yes No B

Expand
Independent Independent
In which way(s) a macroprocessor for assembly language can be macrocalls All of the
13 two-pass one-pass D
implemented ? and substitute above
processor processor
arguments

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 infinite none of these C
implement (b)
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 go to part The shift
Which one of the following statement is false for the SLR (1) and LALR entries in both entries in both of both tables entries in both
19 C
(1) parsing tables for a context free grammar? the tables may the tables may may be the tables may
be different be different different be 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 parsing During the During the


23 In a compiler, when is the keywoards of a language are recognized? lexical analysis of the code data flow A
of a program program generation analysis

Postfix Three address


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

Remove left
Left Factor the Remove left
recursion and
25 To convert an arbitrary CFG to an LL (1) grammar 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.

During ___________, we select a set of variables that will reside in register operand operator register
27 A
register at a point in the program. allocation allocation allocation deallocation

Which of the following symbols table implementation is based on the Self organizing
28 Hash table Search tree Linear list C
property of locality of reference? list
loop local constant
29 Peephole optimization is a form of _______. none of these A
optimization optimization folding

Code
30 Which are the analyses that are not grouped into one pass? Lexical Syntax Semantic D
optimizer

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