MGMU JNECChh.
Sambhajinagar
CSE Dept. AY- 2023-24 Sem: VII
Course: B.Tech I&II
Exam : CA 1
Subject Name: Compiler Design(20UCS702D) Durationa 45 Min
Max Marks: 10 Date:- 17/07/2023
Note: Draw necessary table and diagram. CO BT Marks
QNo level
CO1 LI 5
1. What are the different phases in analysis of source program?
2. Attempt any oneof the following: CO2 L2 5
a) Explain lexical analyzer architecture and it's role with suitable
example.
b) Explain Specification of tokes with operation. L2
MGM UNIVERSITY, AURANGABAD
Departmentof Computer Science & Engineering
Course: B. Tech in CSE CAJ
Subject Name: Compiler Design Semester: VII
Max Marks: 10 Subject Code: 20UCS702D
Date - 10/10/2023 Duration: 45 minute
Instructions to the Students:
1. All questions are
Q No
compulsory.
C.O B.L Ma
rks
Q. 1 Explain translation of assignment statements with
examples. CO4 L2
Q. 2 What are the code optimization techniques? Explain with
examples. CO6 L1 5
MGMUJawaharlal NehruEngineering College, Aurangabad
BATUMid Semester Examination August 2023
Program :B. Tech in Computer Science Sem: VII
Course Name:Compiler Design Subject Code:20UCS702D
Max Marks: 20 Date:- 22/08/2023 Duration:- 1Hr
Instructions to the students
1. Allquestions are compulsory
2. Draw necessary table and diagram
Q No Questions C.O B.L Marks
Q 1 All Questions are compulsory. 6*1
1
Aprogrammer, writes a program to multiply two numbers instead of CO1 L1
dividing them by mistake, how can this error be detected?
a) Compiler or interpreter b) Compiler only
c) Interpreter only None of the mentioned
2 A compiler which allows only the modified section of the source code to L1
CO1
be recompiled is called,
a) Subjective compiler b) Dynamic compiler
c) Re-configurable compiler d) Incremental compiler
3 The number of tokens in the following C statement is, CO1 L1,L2
printf("i =od, &i= %x", i,&i);
a) 3 b) 26 no d) 21
4. What is the name of the process that determines whether tokens can be CO1 L1
generated by a grammar?
a) Analyzing b) Parsing
c) Translating d) Recognizing
5. Which of the following is a part of a compiler that takes as input a CO1 L1
stream of characters and produces as output a stream of words along
with their associted syntactic categories?
a) Optimizer, by Scanner
c) Parser d) None of the mentioned
6. System program such acompiler are designed so that they are CO1 L2
a) Re-enterableb) Non-Usable
c) Serially usabled) None of the mentioned
Q2 Solve any two of the following 3*2
(A) What are the different specification of tokens, explain with it's operation CO2 LI 3
(B) How input buffering can be implemented for scanner, xplain. CO2 LI,L2 3
(C) Convert given NFA to DFA, Write all the steps CO2 L2 3
a, b
Q3 Solve any twoof the following, 4*2
(A) Compute SLR(1) DFAand Action/Goto table for given grammar, Show CO3 L2 4
that the given grammar is SLR(1) or not
S> aSSb| aSSS c
(B) For the following grammar find First and follow and then construct LL(1) CO3 LI,L24
parsing table.
E’TE'
E'’ +TE'/e
T’FT
T'’ *FT'/ [
F’ (E)/id
(C) Compute LR(0) DFAand Action/Goto table for given grammar, Show that CO3 L1,L2 4
the given grammar is LR(0) or not
S’CC
C’ aC|b
MGMUNVERSITY
MGM University
Aurangabad-431003
First Term Exam A.Y. 2023-24 Semester: VII
Program: Computer Science &
Course: Compiler Design Engineering
Marks: 60
Duration: 3 Hrs.
Course Code: 20UCS702D
Instructions to the students:
1. Each question carries 10 marks.
2. All questions are compulsory
O. ustrate your answers with neat sketches, diagram, flowcharts etc wherever necesSary
may appropriately assume it and should mention 1t
sone partor parameter is noticed to be missing, you
clearly Marks
Q1. Solve any two [SM]
a) Explain the various phases of compiler in detail with practical example [SM]
b) Explain compiler construction tools with example. [SM]
c) Define following tools :
1. Compiler 2. Interpreter 3. Assembler 4.
Translator 5. Linker & Loader
Q2, Solve any two
[5M]
a) Difference between NFA and DFA [SM)
suitable diagram
b) Explain about design of lexical analyzer generator with its
[5M]
Howinput buffering can be implemented for scanner, Explain.
Q.3. Solveany two
recursion: E -> E+T|T [SM]
) Consider the following Grammar andremove left
T->T*F|F
F> (E)| id
[5M]
b) Construct SLR parsing table for the following grammar :
S->L)ja
L->L,S|S
[5M]
c Difference between top-down parsing and bottom-up parsing
04. Solve any two
code [SM]
a) Explain three address code and types of three address
and three address code for assignment
b) Write syntax directed definitions to construct syntax tree
statements
[5M]
expression : [5M]
c) Write quadruple, triples and indirect triples for following
(x +y) *(y +) +(x tytz)
Q.5 Solve any two
a) Write Short note on Abstract syntax tree (SM)
Attribute. [SM]
b) Explain S- attribute and L-
Difference between parse tree and syntax tree [5M]
Q.6 Solve any two
example
a) Explain Peephole Optimization techniques with suitable [5M]
b) Short Note on Code Optimization techniques with suitable example [5M)
pTo
c.2. c.1. c)
Consider
AfterDrawa PROD S8
IfI I= S9
=1+ S9
1 = S8S7=SS[S4] S6
= S5S4=S2[S1] S3
=Sl=4x
S2 I Bl:
eliminating = = =
directed <= PROD S3addr(B) addr(A)-4 the
20 x x
goto I following
S6
+ -
acyclic
the L10 S7 4 4
common basic
graph
block
sub-expressions, and
identify
local
re-write
sub-expressions.
common
(3M)
the
basic
block.
(2M)
[SMJ