0% found this document useful (0 votes)
33 views3 pages

Compiler Deisgn 18IS54 Open Ended Test-2

The document is an exam for a compiler design course. It contains 10 multiple choice questions testing various concepts related to compilers such as phases of compilation, assembly, parsing, grammars, and optimization techniques.

Uploaded by

Aditya Singh
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)
33 views3 pages

Compiler Deisgn 18IS54 Open Ended Test-2

The document is an exam for a compiler design course. It contains 10 multiple choice questions testing various concepts related to compilers such as phases of compilation, assembly, parsing, grammars, and optimization techniques.

Uploaded by

Aditya Singh
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/ 3

Department of Information Science & Engineering

USN

FIFTH SEMESTER OPEN ENDED TEST - 2


Subject: Compiler Design Session: July – Dec 2020
Subject Code: 18IS54 Duration: 2:00PM-5:00PM
Date of Examination: 22/10/2020 Max Marks: 10x10 = 100
Note:
 Answer all questions and each question carries 10 Marks.
 Provide neat diagrams wherever applicable.
Bloom
Q.No Question Marks CO’s ’s
Level
1 i) Which of the following is a phase of a compilation process? 1 CO-1 L-1
a) Lexical Analysis b) Code Generation
c) Lexical Analysis & Code Generation d) None of the above
ii) Assembler is a program that _________ 1 CO-1 L-1
a) Puts programs into memory and executes them
b) Translates the assembly language into machine language
c) Writes in high level language and produces an object
program
d) None of the mentioned
iii) 1 CO-2 L-1
_____________ is a graph representation of a derivation
a. The parse tree b. Oct tree
c. Binary tree d. None of the mentioned

iv) Which of these is also known as look-head LR parser? 1 CO-2 L-1


a. SLR b. LR c. LLR d. None
v) Compiler translates the source code to 1 CO-2 L-1
a. Executable code b. Machine code
c. Binary code d. Both B and C
vi) Grammar of the programming is checked at _______ phase of 1 CO-2 L-1
compiler.
a. Semantic analysis b. Syntax analysis
c. Code optimization d. Code generation
vii) For a C program accessing x[i][j][k], the following intermediate code is 1 CO-2 L-1
generated by a compiler. Assume that the size of an integer is 32 bits and
the size of a character is 8 bits.

t0 = i * 1024
t1 = j * 32
t2 = k * 4
t3 = t1 + t0
t4 = t3 + t2
t5 = X[t4]

Page 1 of 3
Which one of the following statements about the source code for the C
program is CORRECT?
a. X is declared as int X[32][32][8]

b. X is declared as int X[4][1024][32]

c. X is declared as char X[4][32][8]

d. X is declared as char X[32][16][2


viii) Consider the following grammar: 1 CO-3 L-2
S -> FR
R -> * S | ε
F -> id
In the predictive parser table, M, of the grammar the entries M [S, id]
and M [R, $] respectively.
a. {S ” FR} and {R ” ε} b. {S ” FR} and {}
c) {S ” FR} and {R ” * S} d. {F ” id} and {R ” ε}
ix) Which one of the following is a top-down parser? 1 CO-3 L-1
a. Recursive descent parser b. Operator precedence parser
c. An LR(k) parser d. An LALR(k) parser
x) Local and loop optimization in turn provide motivation for 1 CO-3 L-1
a. data flow analysis b. constant folding
c. peep hole optimization d. DFA and constant folding

2 a What do you mean by an LR parser? Explain the LR (1) Parsing 5 CO-2 L2


technique?
b Write the differences between canonical collection of LR (0) 5 CO-2 L2
items and LR (1) items?
3 a Construct the canonical collection of LR(0) items for the 10 CO-3 L3
grammar
E -> E + T | T
T -> T * F | F
F-> ( E ) | id

Obtain the parse table for the grammar.


4 a S-> AA 10 CO-3 L4
A-> aA | b

Construct the LR(1) Parsing table with stack operation f? And


explain the Conflicts?
5 a What is YACC? Explain how do you use it in constructing the parser 5 CO-3 L3
using it.
b E -> E + T | T 5 CO-3 L4
T -> T * F | F
F-> ( E ) | id
Construct the LALR (1) Parsing table? And explain the Conflicts?
6 a What is a Syntax Directed Definition? What are the advantages 10 CO-4 L3
of intermediate language? Explain with examples
7 a Explain the 3 types of Implementation of Three Address codes 10 CO-4 L3
with clear example
8 a i. With a clear example give the difference between L-Attribute 10 CO-4 L4
and S-Attribute.
ii. How to construct an abstract syntax tree for arithmetic
expressions.
9 a What are storage allocation strategies? Explain different types of 10 CO-4 L4
strategies with example.
10 a Illustrate two different techniques of optimization of basic 10 CO-5 L4
blocks with clear example.

Page 2 of 3
Course Outcomes:
CO-1 To realize basics of compiler design and apply for real time applications.
CO-2 To introduce different translation languages, using lex, yaac and syntax
CO-3 To understand the importance of code optimization
CO-4 To know about compiler generation tools and techniques
CO-5 To learn working of compiler and non-compiler applications
CO-6 Design a compiler for a simple programming language

L1 L2 L3 L4 L5 L6
Remembering Understanding Applying Analyzing Evaluating Creating

CO/PO: Mapping
(H/M/L indicates strength of correlation) H-High, M-Medium, L-Low
Course Program Outcome (POs)
Outcome
PO-1 PO-2 PO-3 PO-4 PO-5 PO-6 PO-7 PO-8 PO-9 PO-10 PO-11 PO-12
(COs)
CO-1 3 1
CO-2 1 3
CO-3 1 3 1
CO-4 3 1
CO-5 1 3 3
CO-6 1

Page 3 of 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy