JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III COMPILER DESIGN Previous Question Paper (July - 2023 - R16)

B.Tech | III | II | R16 | July - 2023

Answer PaperPaper Code: 136AQMaximum Marks: 75Time: 3 Hours

Note: i) Question paper consists of Part A, Part B. ii) Part A is compulsory, which carries 25 marks. In Part A, Answer all questions. iii) In Part B, Answer any one question from each unit. Each question carries 10 marks and may have a, b as sub questions.

PART - A

1.a

Define finite automata.

2 marks

Answer

A finite automaton is a mathematical model of computation consisting of a finite set of states and a set of transitions from state to state that occur on input symbols. It is defined by a 5-tuple (Q, Σ, δ, q₀, F), where Q is a finite set of states, Σ is a finite set of input symbols (alphabet), δ is the transition function mapping (Q × Σ) to Q, q₀ is the start state, and F is the set of final or accepting states.

1.b

Differentiate pass and phase.

3 marks

Answer

In compiler design, a phase represents a logically distinct stage of the compilation process that performs a specific task, such as lexical analysis, syntax analysis, or code generation. A pass refers to a single traversal of the entire source program or its intermediate representation by the compiler to perform one or more phases.

Key differences include:

  • Multiple phases can be combined into a single pass to improve efficiency by reducing the number of times the compiler reads and writes to memory or disk.
  • A phase is defined by its functional role in the translation process, whereas a pass is defined by the physical traversal of the code structure.
  • Compilers are often designed to minimize the number of passes to reduce compilation time, even if the process involves several distinct logical phases.
1.c

If I is set of items of LR parser, then define CLOSURE(I).

2 marks

Answer

Sign in to view the complete answer paper.

1.d

Differentiate top-down parsing and bottom-up parsing.

3 marks

Answer

Sign in to view the complete answer paper.

1.e

Give different variants of syntax tree.

2 marks

Answer

Sign in to view the complete answer paper.

1.f

What is the purpose of intermediate code in the context of compiler design?

3 marks

Answer

Sign in to view the complete answer paper.

1.g

Define a flow graph. Give an example for it.

2 marks

Answer

Sign in to view the complete answer paper.

1.h

Define basic block.

3 marks

Answer

Sign in to view the complete answer paper.

1.i

What is the meaning of reduction in strength optimization?

2 marks

Answer

Sign in to view the complete answer paper.

1.j

What do you mean by machine independent optimization? How it is different from machine dependent optimization?

3 marks

Answer

Sign in to view the complete answer paper.

PART - B

210 marks
a

Obtain Finite Automata for the regular expression 0*(11)* 0.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain the functions of lexical analyzer.

5 marks

Answer

Sign in to view the complete answer paper.

OR
310 marks
a

Design finite automata for the regular expression (a+b)*aab*.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain the concept of boot strapping to generate new compiler from existing compilers.

5 marks

Answer

Sign in to view the complete answer paper.

4

Construct SLR parsing table for the following context free grammar: E → E + T | T, T → T * F | F, F → id. Where V = { E, T, F }, T = { +, *, id } and E is start variable.

10 marks

Answer

Sign in to view the complete answer paper.

OR
5

Construct LL parsing table for the following context free grammar. S → CC, C → aC | b | a. Where V = {S,C}, T = {a,b} and S is start variable.

10 marks

Answer

Sign in to view the complete answer paper.

610 marks
a

Write intermediate code for the expression a=b*-d + c*-d.

5 marks

Answer

Sign in to view the complete answer paper.

b

What is type checking? Give the rules for type checking of control flow and switch statements.

5 marks

Answer

Sign in to view the complete answer paper.

OR
710 marks
a

Explain different Syntax-Directed Translation Schemes.

5 marks

Answer

Sign in to view the complete answer paper.

b

What are different forms of intermediate code?

5 marks

Answer

Sign in to view the complete answer paper.

810 marks
a

Explain Peephole optimization.

5 marks

Answer

Sign in to view the complete answer paper.

b

Describe the issues in the design of code generator.

5 marks

Answer

Sign in to view the complete answer paper.

OR
910 marks
a

Explain stack allocation method for runtime memory.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain how to optimize basic block.

5 marks

Answer

Sign in to view the complete answer paper.

1010 marks
a

Explain the following optimization techniques: i) Redundant sub expression elimination ii) Copy propagation

7 marks

Answer

Sign in to view the complete answer paper.

b

How flow graph is useful in optimization?

3 marks

Answer

Sign in to view the complete answer paper.

OR
1110 marks
a

Explain the following optimization techniques. i) Loop optimization ii) Dead-code elimination.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain data flow analysis procedure with suitable example.

5 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of COMPILER DESIGN from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for B.Tech CSE(DS) III II, July - 2023, R16.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in COMPILER DESIGN

Loading Question Papers

Fetching data from database...