r05310501 Formal Languages and Automata Theory
r05310501 Formal Languages and Automata Theory
r05310501 Formal Languages and Automata Theory
1
III B.Tech I Semester Regular Examinations, November 2008
FORMAL LANGUAGES AND AUTOMATA THEORY
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
Figure 1b
2. (a) Design a Moore Machine to determine the residue mod 4 for each binary string
treated as integer.
(b) Design a Mealy machine that uses its state to remember the last symbol read
and emits output ‘y’ whenever current input matches to previous one, and
emits n otherwise. [8+8]
(a) R=01[((10)*+111)*+0]*1
(b) ((01+10)*00)*. [8+8]
4. (a) Find the left most and right most derivations for the word abba in the gram-
mar
S →AA
A→aB
B→bB/∈
(b) Write a CFG for EVEN and ODD palindromes. [2×8]
1 of 2
Code No: R05310501 Set No. 1
7. (a) Define a Turing machine mathematically. Define the term ‘move’ in a TM.
(b) Design a TM that recognizes the set
{02n 1n ≥ |n = 0 }. [16]
8. Discuss:
⋆⋆⋆⋆⋆
2 of 2
Code No: R05310501 Set No. 2
III B.Tech I Semester Regular Examinations, November 2008
FORMAL LANGUAGES AND AUTOMATA THEORY
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Consider below transition (diagram 1a) and verify whether the following Strings
will be accepted or not? Explain.
Figure 1a
i. 0011
ii. 010101
iii. 111100
iv. 1011101. [8+8]
(b) Design a DFA, M that accepts the language. L(M) = {w/w ∈ {a,b} * } and
w does not contain 3 consecutive b’s.
2. Construct DFA for given (figure 2) NFA with ∈-moves. [16]
Figure 2
3. Find a Regular expression corresponding to each of the following subsets over
{0,1}*.
(a) The set of all strings containing no three consecutive 0’s.
(b) The set of all strings where the 10th symbol from right end is a 1.
1 of 2
Code No: R05310501 Set No. 2
(c) The set of all strings over {0,1} having even number of 0’s & odd number of
1’s.
(d) The set of all strings over {0,1} in which the number of occurrences of is
divisible by 3. [4×4]
4. (a) Obtain a right linear grammar for the following FA as shown in figure 4a.
Figure 4a
(b) Obtain a left linear grammar for the above FA. [2×8]
5. (a) Prove that the following language is not context-free language
n n j
L1 = {a b c n ≤ j ≤ 2n}
(b) Simplify the following grammar:
S → AB
A→a
B→C
B→b
C→D
D →E. [8+8]
6. (a) Construct the PDA corresponding to the grammar:
S→aABB/aAA
A→aBB/a
B→bBB/A.
(b) Construct a PDA that accepts the language
L = {wcwR /w ∈ {a, b}∗ }. [8+8]
7. (a) Briefly explain the properties of recursive enumerable languages.
(b) Design Turing machine to recognize the palindromes of digits {0,1}. Give its
state transition diagram also. [8+8]
8. Give LR(0) items for the grammar S’→S , S→aSa/bSb/c. Find its equivalent DFA.
Check the parsing by taking a suitable string. [16]
⋆⋆⋆⋆⋆
2 of 2
Code No: R05310501 Set No. 3
III B.Tech I Semester Regular Examinations, November 2008
FORMAL LANGUAGES AND AUTOMATA THEORY
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Design DFA to accept strings with c and d such that number d’s are divisible
by 4
(b) Design DFA which accepts language L ={ 0,000,00000,........} over {0}. [8+8]
2. For the following NFA with ∈ -moves convert it in to an NFA with out ∈ -moves
and show that NFA with ∈-moves accepts the same language as shown in figure 2.
[16]
Figure 2
3. Consider the two regular expressions
r=0*+1*, s=01*10*+1*0+(0*1)*
6. (a) Define PDA. In what ways a PDA can show the acceptance of a string. Explain
with examples.
(b) Construct the PDA M for the language L={wwR /w ∈ {a, b}∗ } such that
L=L(M). [8+8]
1 of 2
Code No: R05310501 Set No. 3
7. (a) Let T be the Turing machine defined by the five tuples:
(q0 , 0, q1 , 1, R), (q0 , 1, q1 , 0, r), (q0 , B, q1 , 0, R),
(q1 , 0, q2 1, L), (q1 , 1, q1 , 0, r)(q1 , B, q2 , 0, L).
for each of the following initial tapes, determine the final tape when T halts,
assuming that T begins in initial position.
(b) Design a Turing machine to add two given integers. [8+8]
8. (a) Write a type 2 grammar with productions that generate the language.
L={0n 1n /n >= 0}
(b) Write short notes on linear bound automata. [8+8]
⋆⋆⋆⋆⋆
2 of 2
Code No: R05310501 Set No. 4
III B.Tech I Semester Regular Examinations, November 2008
FORMAL LANGUAGES AND AUTOMATA THEORY
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. Out of the following languages, which are/is accepted by given FA and explain as
shown in figure 1.
Figure 1
(a) (a+b)* (c+d)* (ef)*
(b) (ab)* (cd)* (ef)*
(c) (a+b)*+(c+d)*+(ef)*
(d) ( (ab)*+ (cd)*+ (ef)* ) *. [4×4]
Figure 2a
(b) Construct DFA for given FA as shown in figure 2b. [8+8]
1 of 2
Code No: R05310501 Set No. 4
Figure 2b
3. Give a regular expression for the following language
L = {x ∈ {0, 1}∗ |x ends with 1 and does not contain the sub string 00}. [16]
6. (a) Find the PDA with only one state that accepts the language {am bn : n > m }
(b) Construct the PDA that recognizes the languages L={x=×R : x∈{a,b}+ }.
[8+8]
⋆⋆⋆⋆⋆
2 of 2