ACD First Mid Question Paper
ACD First Mid Question Paper
ACD First Mid Question Paper
Unit -1
1 a) Explain the relationship between Regular Expressions Relation and Finite State Machine
4M)
1 b) DFA for formal language which contains 0110 as substring over an alphabet {0, 1}.(6M)
2a) Explain the process of converting NFA to DFA and solve the given
instance (4M)
2b) Convert the following NFA into equivalent DFA?
6M)
3a) Describe how Thompson’s method converts Regular expression into NFA by
Providing a concrete example. (6M)
3b) How does lexical analysis work? Distinguish between a lexeme, a pattern,
and a
token.
(4M)
4a) Construct an optimized DFA for the following regular expression. (a|b) (a|b)
a* (6M)
4b) Write the procedure for the following .i. Minimization ii. Epsilon – closure
b) Describe the role of lexical analyzer in the design of compiler and explain
with
example.
Unit -2
1a)Give the rules for computation of FIRST(X) and FOLLOW(X).
(4M)
1b)Construct FIRST and FOLLOW sets for the following grammar.
(6M)
E -> T E’
E’ -> +T E’ |e
T -> F T’
T’ -> *FT’ |e
F -> (E) | id
2a) What are the necessary conditions to be carried out before the construction
of (4M)
predictive parser?
2b) S-->(L) /a
(6M)
L-->L,S /S
Construct the behavior of the parser on the sentence (a,a) using the grammar
specified above.
3a)Explain the necessary conditions to be carried out before the construction of
Recursive Descent parser?
(4M)
3b) Construct recursive descent parser for the following grammar. (e = Epsilon)
(6M)
E -> T E'
E' -> +T E | e
T -> F T'
T' -> *FT' |e
F -> (E) | id
4a)Define a grammar,CFG,LMD and RMD’s?
(4M)
4b) Consider the following grammar,construct LMD trees and RMD trees for the
string “aaabbabbba” S->bA/aB , A->aS/aAA/a, B->bS/aBB/b
(6M)
5a)Define ambiguous grammar ,check whether the following grammar is
ambiguous or not?
S->iCtS , s->iCtSeS, S-a, C-b
(4M)
5b)Define Left recursion ,Right recursion and Left Factoring, eliminate the left
recursion from the following grammar?
(6M)
E → EE +
E → EE ∗
E → num
Unit -3
1a)Give various forms of 3 Address code ? (4M)
1b)Give quadruples ,triples and indirect triples representations for the
following (6M)
expression –(a+b)*(c+d)+(a+b+c)
2a)Define a Regular,CFG,CSG and unrestricted grammars?
(3M)
2b) Give the classification of Chomsky hierarchy of languages with a neat
diagram? (6M)
3a)What is a Three Address code? Give various forms of it?
(3M)
3b) Explain various forms of intermediate code? Give them for the following
expression
(a+b) * (a+b+c) (7M)