Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech III AUTOMATA AND COMPILER DESIGN Previous Question Paper (February - 2022 - R15)

B.Tech | III | I | R15 | February - 2022

Answer PaperPaper Code: 125DRMaximum Marks: 75Time: 3 hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Construct a Finite Automata accepting all strings over {0,1} i) Having odd number of 0’s and ii) having even number of 1’s?

8 marks

Answer

To construct a Deterministic Finite Automata (DFA) that accepts strings with an odd number of 0's and an even number of 1's, we define four states representing the parity of 0's and 1's: q00 (even 0's, even 1's), q01 (even 0's, odd 1's), q10 (odd 0's, even 1's), and q11 (odd 0's, odd 1's).

The start state is q00. The transitions are as follows:

  • From q00: on 0 go to q10, on 1 go to q01
  • From q01: on 0 go to q11, on 1 go to q00
  • From q10: on 0 go to q00, on 1 go to q11
  • From q11: on 0 go to q01, on 1 go to q10

The final state is q10, as it represents the condition of having an odd number of 0's and an even number of 1's.

b

How to convert a regular expression to NFA? Explain with example.

7 marks

Answer

The conversion of a regular expression to an NFA is performed using Thompson's Construction algorithm, which builds the NFA compositionally based on the structure of the regular expression.

  1. Base cases: For the empty string ε, create a start state with an ε-transition to an accepting state. For a symbol 'a', create a transition from start to end state labeled 'a'.
  2. Union (r|s): Create a new start state with ε-transitions to the start states of NFA(r) and NFA(s), and ε-transitions from their end states to a new final state.
  3. Concatenation (rs): Connect the end state of NFA(r) to the start state of NFA(s) using an ε-transition.
  4. Kleene Closure (r*): Create a new start and end state. Add ε-transitions from the new start to the old start, from the old end to the new end, from the old end back to the old start, and from the new start to the new end to allow for zero occurrences.

Example: For the expression (a|b)*, we first construct the NFA for 'a' and 'b', apply the union construction to get (a|b), and finally apply the Kleene closure construction to obtain the resulting NFA.

215 marks
a

Draw a NFA that accept the languages that have ‘a’ as third symbol from right hand side over {a, b}.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write about the identity rules for regular expressions.

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Briefly give a note on L-attributed grammars.

7 marks

Answer

Sign in to view the complete answer paper.

b

Define ambiguous grammar? Explain with an example.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Explain abstract syntax tree with an example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Give a model for LR parser. Write an algorithm for LR parsing.

8 marks

Answer

Sign in to view the complete answer paper.

5

Explain the specification of a simple type checker.

15 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Give some solutions to resolve an overloaded symbol.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write short note on function overloading.

8 marks

Answer

Sign in to view the complete answer paper.

7

Define code optimization. Explain in detail about the principal sources of optimization and optimization techniques.

15 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

State the issues in code generation process.

7 marks

Answer

Sign in to view the complete answer paper.

b

What is a basic block? With suitable example – discuss various transformations on the basic block.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of AUTOMATA AND COMPILER DESIGN from Jawaharlal Nehru Technological University Hyderabad for B.Tech IT III I, February - 2022, R15.

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

Other papers in AUTOMATA AND COMPILER DESIGN

Loading Question Papers

Fetching data from database...