JNTU

JNTU B.Tech III PRINCIPLES OF COMPILER CONSTRUCTION Previous Question Paper (February - 2023 - R18)

B.Tech | III | II | R18 | February - 2023

Answer PaperPaper Code: 156CPMaximum 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

125 marks
a

Define Finite Automata and Regular Expression.

2 marks

Answer

A Finite Automaton is a mathematical model of computation consisting of a finite set of states, a set of input symbols, a transition function, a start state, and a set of accept states. A Regular Expression is a notation used to describe a regular language, defined recursively using operators like union (+), concatenation (.), and Kleene closure (*).

b

Convert the following regular expression to DFA: (a*|b*)*.

3 marks

Answer

The regular expression (a*|b*)* simplifies to (a|b)*, which represents the set of all strings over the alphabet {a, b}. The corresponding DFA consists of a single state, q0, which is both the start state and the accepting state, with transitions on both 'a' and 'b' leading back to q0.

c

Why do we need LR parsers?

2 marks

Answer

Sign in to view the complete answer paper.

d

What are the advantages and disadvantages of predictive parsers?

3 marks

Answer

Sign in to view the complete answer paper.

e

Define synthesized attributes and inherited attributes.

2 marks

Answer

Sign in to view the complete answer paper.

f

What is a Dependency graph? Give an example.

3 marks

Answer

Sign in to view the complete answer paper.

g

What is meant by DAG?

2 marks

Answer

Sign in to view the complete answer paper.

h

Write down the algorithm to partition a three-address code into basic blocks.

3 marks

Answer

Sign in to view the complete answer paper.

i

Define a flow graph.

2 marks

Answer

Sign in to view the complete answer paper.

j

How to compute IN and OUT statements in data flow analysis?

3 marks

Answer

Sign in to view the complete answer paper.

Part B

210 marks
a

Discuss the role of the Lexical Analyzer.

5 marks

Answer

Sign in to view the complete answer paper.

b

How a compiler differs from an assembler and an assembler and an interpreter? Describe the structure of a language processing system with a neat diagram.

5 marks

Answer

Sign in to view the complete answer paper.

OR
310 marks
a

Why analysis portion of a compiler is normally separated into lexical analysis and syntax analysis phases?

4 marks

Answer

Sign in to view the complete answer paper.

b

Discuss the problem of recognizing and specifying lexemes in the input.

6 marks

Answer

Sign in to view the complete answer paper.

410 marks
a

What are the techniques to eliminate ambiguity in the grammar? With the help of the algorithm and example, explain them.

6 marks

Answer

Sign in to view the complete answer paper.

b

Write down the differences between top-down parsers and bottom-up parsers.

4 marks

Answer

Sign in to view the complete answer paper.

OR
5

Construct SLR parser table for the following grammar by computing item sets: E→E + T | T, T→T * F | F, F → (E)/id

10 marks

Answer

Sign in to view the complete answer paper.

6

Design an S-attributed SDD for the following grammar that generates binary numbers with a “decimal” point. S → L . L | L, L → L B | B, B → 0 | 1

10 marks

Answer

Sign in to view the complete answer paper.

OR
7

Discuss briefly about Three-Address code and translate the following arithmetic expression a+ - (b+c) into:

  • a) a syntax tree
  • b) quadraples
  • c) triples
  • d) indirect triples.
10 marks

Answer

Sign in to view the complete answer paper.

8

What are the important types of local optimizations that can be applied to basic blocks? Explain them with a illustrative examples.

10 marks

Answer

Sign in to view the complete answer paper.

OR
910 marks
a

Mention the issues in the design of a code generator.

5 marks

Answer

Sign in to view the complete answer paper.

b

Outline various storage allocation strategies.

5 marks

Answer

Sign in to view the complete answer paper.

10

Explain the purpose of optimization using global data-flow analysis with relevant example.

10 marks

Answer

Sign in to view the complete answer paper.

OR
11

Explain the following loop optimization techniques with an example:

10 marks
a

Code motion

3 marks

Answer

Sign in to view the complete answer paper.

b

Induction-variable elimination

4 marks

Answer

Sign in to view the complete answer paper.

c

Strength Reduction.

3 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of PRINCIPLES OF COMPILER CONSTRUCTION from JNTU for B.Tech IT III II, February - 2023, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in PRINCIPLES OF COMPILER CONSTRUCTION

Loading Question Papers

Fetching data from database...