JNTU
JNTU B.Tech III PRINCIPLES OF COMPILER CONSTRUCTION Previous Question Paper (February - 2023 - R18)
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
Define Finite Automata and Regular Expression.
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 (*).
Convert the following regular expression to DFA: (a*|b*)*.
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.
Why do we need LR parsers?
Answer
Sign in to view the complete answer paper.
What are the advantages and disadvantages of predictive parsers?
Answer
Sign in to view the complete answer paper.
Define synthesized attributes and inherited attributes.
Answer
Sign in to view the complete answer paper.
What is a Dependency graph? Give an example.
Answer
Sign in to view the complete answer paper.
What is meant by DAG?
Answer
Sign in to view the complete answer paper.
Write down the algorithm to partition a three-address code into basic blocks.
Answer
Sign in to view the complete answer paper.
Define a flow graph.
Answer
Sign in to view the complete answer paper.
How to compute IN and OUT statements in data flow analysis?
Answer
Sign in to view the complete answer paper.
Part B
Discuss the role of the Lexical Analyzer.
Answer
Sign in to view the complete answer paper.
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.
Answer
Sign in to view the complete answer paper.
Why analysis portion of a compiler is normally separated into lexical analysis and syntax analysis phases?
Answer
Sign in to view the complete answer paper.
Discuss the problem of recognizing and specifying lexemes in the input.
Answer
Sign in to view the complete answer paper.
What are the techniques to eliminate ambiguity in the grammar? With the help of the algorithm and example, explain them.
Answer
Sign in to view the complete answer paper.
Write down the differences between top-down parsers and bottom-up parsers.
Answer
Sign in to view the complete answer paper.
Construct SLR parser table for the following grammar by computing item sets: E→E + T | T, T→T * F | F, F → (E)/id
Answer
Sign in to view the complete answer paper.
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
Answer
Sign in to view the complete answer paper.
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.
Answer
Sign in to view the complete answer paper.
What are the important types of local optimizations that can be applied to basic blocks? Explain them with a illustrative examples.
Answer
Sign in to view the complete answer paper.
Mention the issues in the design of a code generator.
Answer
Sign in to view the complete answer paper.
Outline various storage allocation strategies.
Answer
Sign in to view the complete answer paper.
Explain the purpose of optimization using global data-flow analysis with relevant example.
Answer
Sign in to view the complete answer paper.
Explain the following loop optimization techniques with an example:
Code motion
Answer
Sign in to view the complete answer paper.
Induction-variable elimination
Answer
Sign in to view the complete answer paper.
Strength Reduction.
Answer
Sign in to view the complete answer paper.