JNTU

JNTU B.Tech III COMPILER DESIGN Previous Question Paper (March - 2024 - R13)

B.Tech | III | I | R13 | March - 2024

Answer PaperPaper Code: 115APMaximum 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 lexeme, token, pattern.

2 marks

Answer

A lexeme is a sequence of characters in the source program that matches the pattern for a token. A token is a category or classification of lexemes (e.g., identifier, keyword). A pattern is a rule or description (often expressed as a regular expression) that determines which lexemes belong to a specific token category.

b

Construct the transition diagram for relational operators in 'C'.

3 marks

Answer

The transition diagram for relational operators (>, >=, <, <=, ==, !=) starts at a state and branches based on the input character:

  • Start state: if '>', go to state 1; if '<', go to state 3; if '=', go to state 5; if '!', go to state 7.
  • State 1: if '=', go to state 2 (>=); else return token >.
  • State 3: if '=', go to state 4 (<=); else return token <.
  • State 5: if '=', go to state 6 (==).
  • State 7: if '=', go to state 8 (!=).
c

What is meant by goto function in LR parser? Give an example.

2 marks

Answer

Sign in to view the complete answer paper.

d

For the grammar S->0S1 | 01. Indicate the handle in each of the following right-sentential forms: i) 000111 ii) 00S11

3 marks

Answer

Sign in to view the complete answer paper.

e

Write SDTs for the Boolean expression grammar

2 marks

Answer

Sign in to view the complete answer paper.

f

List the properties of a Memory manager for efficient usage of memory.

3 marks

Answer

Sign in to view the complete answer paper.

g

What is a DAG?

2 marks

Answer

Sign in to view the complete answer paper.

h

Define flow graph and provide an example.

3 marks

Answer

Sign in to view the complete answer paper.

i

What is machine dependent optimization?

2 marks

Answer

Sign in to view the complete answer paper.

j

How would you calculate the cost of an instruction with an example?

3 marks

Answer

Sign in to view the complete answer paper.

Part B

210 marks
a

Explain the various phases of a compiler. Show the translations for an assignment statement position=initial+rate *60, clearly indicate the output of each phase.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain the concept of bootstrapping in the context of compilation, discussing its significance and potential challenges.

5 marks

Answer

Sign in to view the complete answer paper.

OR
310 marks
a

Construct recursive descent parsing for the following grammar.

5 marks

Answer

Sign in to view the complete answer paper.

b

Construct predictive parsing table for the following grammar: S → (L) | a L → L, S | S. Check whether the string (a, ((a , a), (a , a))) belongs to that language or not.

5 marks

Answer

Sign in to view the complete answer paper.

410 marks
a

Explain shift-reduce parsing with stack implementation.

5 marks

Answer

Sign in to view the complete answer paper.

b

Build LR(1) parser and check the validity of the input string “id+id*id” by the LR(1) parser for the given grammar E → E+T/T, T → T*F/F, F → (E)/id

5 marks

Answer

Sign in to view the complete answer paper.

OR
510 marks
a

Discuss the challenges associated with error recovery in parsing.

5 marks

Answer

Sign in to view the complete answer paper.

b

Construct an LALR parsing table for the following grammar:

5 marks

Answer

Sign in to view the complete answer paper.

610 marks
a

For the grammar below: E → E + T | T, T → num .num | num Give an SDD to determine the type of each term T and expression E.

5 marks

Answer

Sign in to view the complete answer paper.

b

Write the translation scheme for type checking of function declaration.

5 marks

Answer

Sign in to view the complete answer paper.

OR
710 marks
a

Explain tree structured symbol tables.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain in detail, the strategy for reducing fragmentation in heap memory.

5 marks

Answer

Sign in to view the complete answer paper.

810 marks
a

Discuss about principal sources of optimization with example.

5 marks

Answer

Sign in to view the complete answer paper.

b

Write a short note on following optimizations concepts: i) Frequency reduction ii) Folding.

5 marks

Answer

Sign in to view the complete answer paper.

OR
910 marks
a

Generate the flow-graphs for the following expressions:

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain about common sub expression elimination with an example.

5 marks

Answer

Sign in to view the complete answer paper.

1010 marks
a

Discuss the issues in code generation.

5 marks

Answer

Sign in to view the complete answer paper.

b

Discuss about register allocation and assignment in target code generation.

5 marks

Answer

Sign in to view the complete answer paper.

OR
1110 marks
a

What is peephole optimization? How can it be performed? Give its role in code generation.

5 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm for generating code from DAG with an example.

5 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of COMPILER DESIGN from JNTU for B.Tech ECM III I, March - 2024, R13.

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

Other papers in COMPILER DESIGN

Loading Question Papers

Fetching data from database...