JNTU

JNTU B.Tech III COMPILER DESIGN Previous Question Paper (August/September - 2024 - R16)

B.Tech | III | II | R16 | August/September - 2024

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

125 marks
a

What is the role of the lexical analyzer in a compiler?

2 marks

Answer

The lexical analyzer, or scanner, reads the input source code character by character and groups them into meaningful sequences called lexemes. It then produces a stream of tokens as output, which are passed to the syntax analyzer for further processing, while also removing whitespace and comments.

b

State and briefly explain the need for a language translator.

3 marks

Answer

A language translator is necessary because computer hardware can only execute machine code (binary). Since programmers write code in high-level languages that are human-readable, a translator is required to convert this source code into an equivalent machine-executable form so the computer can perform the intended operations.

c

What are the benefits of LR parsers over LL parsers?

2 marks

Answer

Sign in to view the complete answer paper.

d

Compare and contrast Top down parsing and bottom up parsing techniques.

3 marks

Answer

Sign in to view the complete answer paper.

e

Define context-free grammars.

2 marks

Answer

Sign in to view the complete answer paper.

f

Define synthesized attributes and inherited attributes.

3 marks

Answer

Sign in to view the complete answer paper.

g

What are the key components of a run-time environment?

2 marks

Answer

Sign in to view the complete answer paper.

h

How to identify a leader in a basic block provide example?

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

Write about IN and OUT statements in data-flow analysis.

3 marks

Answer

Sign in to view the complete answer paper.

Part B

2

Create a flowchart illustrating the process of lexical analysis, including input buffering, token recognition, and the role of a lexical analyzer.

10 marks

Answer

Sign in to view the complete answer paper.

OR
3

Design a regular expression and corresponding finite automaton to recognize valid identifiers in a programming language, considering alphanumeric characters and underscores, ensuring that the automaton is deterministic.

10 marks

Answer

Sign in to view the complete answer paper.

4

Evaluate the significance of LR parsing in compiler construction, especially in handling ambiguous grammars and improving parsing efficiency. Provide examples to support your argument.

10 marks

Answer

Sign in to view the complete answer paper.

OR
5

Develop a context-free grammar for a simple arithmetic expression language, including rules for addition, subtraction, multiplication, and division. Illustrate the grammar with production rules and example expressions.

10 marks

Answer

Sign in to view the complete answer paper.

6

Design a Syntax-Directed Translation Scheme (SDTS) to convert infix arithmetic expressions into postfix notation. Include semantic actions and attribute values to annotate the syntax tree.

10 marks

Answer

Sign in to view the complete answer paper.

OR
7

Develop a set of semantic rules to perform type checking in a programming language compiler. Consider different types (e.g., integer, floating-point, boolean) and type compatibility rules.

10 marks

Answer

Sign in to view the complete answer paper.

8

Analyze the advantages and disadvantages of stack allocation versus heap management in run-time environments, considering factors such as memory efficiency, access time, and fragmentation.

10 marks

Answer

Sign in to view the complete answer paper.

OR
9

Evaluate the importance of garbage collection in modern programming languages. Discuss different garbage collection algorithms and their suitability for different application scenarios.

10 marks

Answer

Sign in to view the complete answer paper.

10

Apply the concept of constant propagation to optimize the following code snippet:

int x = 5;
int y = x + 3;
int z = y * 2;
10 marks

Answer

Sign in to view the complete answer paper.

OR
11

Analyze the importance of partial-redundancy elimination in compiler optimization. Discuss how it differs from other optimization techniques and its impact on code quality.

10 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of COMPILER DESIGN from JNTU for B.Tech ECM III II, August/September - 2024, 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...