r05310501 formal languages and automata theory

8

Click here to load reader

Upload: mohammed-muzammil

Post on 06-Apr-2015

328 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 1

III B.Tech I Semester Regular Examinations, November 2008FORMAL LANGUAGES AND AUTOMATA THEORY

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Define NFA and explain with an example.

(b) Conclude what type of strings will be accepted by the below Finite automataas shown in figure 1b. [6+10]

Figure 1b

2. (a) Design a Moore Machine to determine the residue mod 4 for each binary stringtreated as integer.

(b) Design a Mealy machine that uses its state to remember the last symbol readand emits output ‘y’ whenever current input matches to previous one, andemits n otherwise. [8+8]

3. Construct an NFA for the following:

(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-marS →AAA→aBB→bB/∈

(b) Write a CFG for EVEN and ODD palindromes. [2×8]

5. (a) Explain Chomsky hierarchy.

(b) Construct PDA for set of all strings of balanced parenthesis. [8+8]

6. (a) Let G be the grammar given byS→aABB/aAA,A→aBB/a,B→bBB/AConstruct the PDA that accepts the language generated by this grammar G.

(b) Define Deterministic pushdown automata. Explain with an example. [8+8]

1 of 2

Page 2: r05310501 Formal Languages and Automata Theory

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{02n1n ≥ |n = 0 }. [16]

8. Discuss:

(a) The Hierarchy theorem.

(b) LR(0) grammar.

(c) Universal Turing Machine. [6+5+5]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

Page 3: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 2

III B.Tech I Semester Regular Examinations, November 2008FORMAL LANGUAGES AND AUTOMATA THEORY

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Consider below transition (diagram 1a) and verify whether the following Stringswill 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} * } andw 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

Page 4: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 2

(c) The set of all strings over {0,1} having even number of 0’s & odd number of1’s.

(d) The set of all strings over {0,1} in which the number of occurrences of isdivisible 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 languageL1= {anbncj

/

n ≤ j ≤ 2n}

(b) Simplify the following grammar:S → ABA → aB → CB → bC → DD →E. [8+8]

6. (a) Construct the PDA corresponding to the grammar:S→aABB/aAAA→aBB/aB→bBB/A.

(b) Construct a PDA that accepts the languageL = {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 itsstate 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

Page 5: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 3

III B.Tech I Semester Regular Examinations, November 2008FORMAL LANGUAGES AND AUTOMATA THEORY

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Design DFA to accept strings with c and d such that number d’s are divisibleby 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 ∈ -movesand show that NFA with ∈-moves accepts the same language as shown in figure 2.

[16]

Figure 2

3. Consider the two regular expressionsr=0*+1*, s=01*10*+1*0+(0*1)*

(a) Find a string corresponding to r but not to s.

(b) Find a string corresponding to s but not to r. [8+8]

4. Construct DFA for the following Regular expression( ( a U b)* ( b U a)*)*. [16]

5. (a) When is a grammar is said to be in reduced form.

(b) Convert the following grammar to GNF:G = ({A1, A2, A3}, {a, b}, P1, A1)Where P consists of the following:A1 → A2A3

A2 → A3A1/bA3 → A1A2/a. [8+8]

6. (a) Define PDA. In what ways a PDA can show the acceptance of a string. Explainwith examples.

(b) Construct the PDA M for the language L={wwR/w ∈ {a, b}∗} such thatL=L(M). [8+8]

1 of 2

Page 6: r05310501 Formal Languages and Automata Theory

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, q21, 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={0n1n/n >= 0}

(b) Write short notes on linear bound automata. [8+8]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

Page 7: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 4

III B.Tech I Semester Regular Examinations, November 2008FORMAL LANGUAGES AND AUTOMATA THEORY

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. Out of the following languages, which are/is accepted by given FA and explain asshown 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]

2. (a) Show that the FA are equivalent as shown in figure 2a.

Figure 2a

(b) Construct DFA for given FA as shown in figure 2b. [8+8]

1 of 2

Page 8: r05310501 Formal Languages and Automata Theory

Code No: R05310501 Set No. 4

Figure 2b

3. Give a regular expression for the following languageL = {x ∈ {0, 1}∗ |x ends with 1 and does not contain the sub string 00}. [16]

4. (a) Construct DFA for the following regular expression ( ab U aba)*a

(b) Write recursive definition of regular expression? [12+4]

5. (a) Show that L = {aibj/j = i2} is not context free language.

(b) List the properties of CFLs.

(c) Find if the given grammar is finite or infinite.S→AB, A→BC/a, B→CC/b, C→a. [8+5+3]

6. (a) Find the PDA with only one state that accepts the language {ambn : n > m }

(b) Construct the PDA that recognizes the languages L={x=×R: x∈{a,b}+}.[8+8]

7. (a) Design A Turing machine that accepts L = {anbn |n ≥ 0 }

(b) What does the Turing Machine described by the 5-tules(q0, 0, q0 R), (q0, 1, q1, 0, r), (q0, B, q2, B, R),(q1, 0, q1, 0, R), (q1, 1, q0, 1, R) and (q1, B, q2, B, R)do when given a bit string as input? [8+8]

8. Write short notes on:

(a) Church’s hypothesis.

(b) Ogden’s lemma.

(c) DPDA. [6+5+5]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2