At Flat HMP-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Sankalchand Patel College of Engineering,Visnagar

Compter Engineering/Information Technology


Question Bank
Subject Code: 1ET1030604 Subject Title: Formal Language & Automata Theory
Class :VIth CE/IT

Unit 1: Review of Basic Mathematical Concepts:


1. Check whether the function f: R ->R+, f(x) = x2 is “one to one” or “onto”
2. Using Principle of Mathematical Induction, Prove that , For every n >= 1,
n
Σ i2 = n (n+1)(2n+1)/ 6
i=1
3. Using Principle of Mathematical Induction, prove that for every n >= 1,
n
Σ i = n (n+1) / 2
i=0

4. Using Principle of Mathematical Induction, prove that for every n >= 1,


7 + 13 + 19 + . . . + (6n + 1) = n(3n +4)
5. Define Set and explain the different operation perform on set.
6. Given Relation R in A as R={(1,1),(2,2),(2,3),(3,2),(4,2),(4,4)} is R reflexive,
symmetric, transitive or antisymmetric. Justify.
7. Show that 2n>n3 for n>10 by mathematical Induction.

Unit 2: Regular Languages and Deterministic Finite Automata:


1. In each case, find a string of minimum length in {0, 1}* not in the language corresponding
to the given regular expression.
i. 1*(01)*0*
ii. (0* + 1*)(0* + 1*)(0* + 1*)
iii. 0*(100*)*1*
iv. 1*(0 + 10)*1*
2. Consider the two regular expressions
r=0* + 1* s=01* + 10* + 1*0 + (0*1)*
i. Find a string corresponding to r but not to s.
ii. Find a string corresponding to s but not to r.
iii. Find a string corresponding to both r and s.
iv. Find a string in {0, 1}* corresponding to neither r nor s.
3. Find a regular expression corresponding to each of the following subsets of {0, 1}*
i. The language of all strings containing exactly two 0’s.
ii. The language of all strings containing at least two 0’s.
iii. The language of all strings that do not end with 01.
iv. The language of all strings that begin or end with 00 or 11.
v. The language of all strings not containing the substring 00.
vi.
vii. The language of all strings in which the number of 0’s is even.
viii.
ix. The language of all strings containing no more than one occurrence of the string 00.
x. The language of all strings in which every o is followed immediately by 11.
xi. The language of all strings containing both 11 and 010 as substring.
4. For each of the following regular expressions, draw an FA recognizing the corresponding
language.
i.
i. (0 + 1)*0
ii. (11 + 10)*
iii. (0 + 1)*(1 + 00)(0 + 1)*
iv. (111 + 100)*0
v. 0 + 10* + 01*0
vi. (0 + 1)*(01 + 110)
5. Draw Finite Automata (FA) for following languages:
L 1 = {x / 00 is not a substring of x }
L 2 = {x / x ends with 01 }
Find FA accepting languages (i) L1 ∩ L2 (ii) L2 – L1 (iii) L1 Ụ L2( iv) L1 − L2
6. Prove Kleene’s Theorem (Part I): Any Regular Language can be accepted by a Finite
Automaton (FA).
7. Draw an DFA that recognize the language of all strings of 0’s and 1’s of length at least 1 that, if
they were interpreted as binary representation of integers, would represent evenly divisible by
3. Your DFA should acceptthe string 0 but no other strings with leading 0’s.
8. Convert the Mealy machine shown in given figure into Moore machine.

9. Minimize the following FSM

Unit 3:Non Deterministic FA and Non Deterministic FA- ^:

1. Compare FA, NFA and NFA- Λ with illustration.For the following Regular Expression
draw an NFA-Λ recognizing the corresponding language.
(0 + 1) * (10+01) * 11
2. Consider the following NFA shown in Figure 1 and convert it into DFA

3. convert the following NFA to DFA.


4. Construct NFA-^ that accepts the language represented by the regular expression (aa + b)* and
((a + b)a*)*

5. For the following Regular Expression draw an NFA- Λ recognizing the corresponding
languages.
(i) (00 + 1) * (10) *
(ii) 001 * 0 * 11

6. consider the NDFA shown in the figure below.Convert it into DFA

7. convert the following NFA- ^ to NFA

8. convert the following NFA- ^ to NFA

9. An NFA with states 1-5 and input alphabet {a, b} has the following transition table.

Q δ(q, a) δ(q, b)
1 {1, 2} {1}
2 {3} {3}
3 {4} {4}
4 {5} Ø
5 Ø {5}
1. Draw a transition diagram.
2. Calculate δ*(1, ab).
3. Calculate δ*(1, abaab).
10. A transition table is given for an NFA-^ with seven states.

Q δ(q, a) δ(q, b) δ(q, )


1 Ø Ø {2}
2 {3} Ø {5}
3 Ø {4} Ø
4 {4} Ø {1}
5 Ø {6, 7} Ø
6 {5} Ø Ø
7 Ø Ø {1}

Find:
1. ^({2, 3})
2. ^({1})
3. ^({3, 4})
4. δ*(1, ba)
5. δ*(1, ab)
6. δ*(1, ababa)

Unit 4: Context free grammar (CFG):


1. In each case, say what language is generated by the context-free grammar with the indicated
productions.
a) S → aSa | bSb | ^
b) S → aSa | bSb | a | b
c) S → aSb |bSa | ^
d) S → aSa | bSb | aAb |bAa
A→ aAa | bBb | a | b |^
e) S → aS | bS | a
f) S → SS | bS | a
g) S → SaS | b
h) S → aT | bT |^
T → aS | bS

2. For the given CFG


S → bS | aT |^
T → aT | bU | ^
U → aT | ^
Generate the language of all string stacks over the alphabet {a, b} that do not contain the
substring abb.

3. Define CFG and Design a CFG for the following language.


L = { x ∈ {0,1}* | n0(x) ≠ n1(x) }
4. Design a CFG for the following languages.
L = { 0i 1j 0k / j > i + k } and L = { a i b j c k | i = j or j = k }
5. What language over {0, 1} does the CFG with productions
S → 00S | 11S | S00 | S11 | 01S01 | 01S10 | 10S10 | 10S01|^ generate? Prove your answer.

6. Show that the CFG with productions


S → a | Sa | bSS | SSb | SbS is ambiguous.
7. Show that the CFG with productions
S → S(S) | ^ is Unambiguous.

8. In each case, given the context-free grammar G, find a CFG G’ with no ^-productions and no
unit productions that generates the language L(G) – {^}.
a) G has productions
S → ABA A → aA | B → bB |
b) G has productions
S → aSa | bSb | A → aBb | bBa B → aB | bB |
c) G has productions
S →A| B | C A → aAa | B B → bB | bb C → aCaa | D
D → baD | abD | aa

7. Given the CFG G, find a CFG G’ in Chomsky Normal form generating L(G) – { Λ}
S->A | B | C
A->aAa | B
B->bB | bb
C->aCaa | D
D->baD | abD | aa

8. In each case, given the context free grammar G, find a CFG G’ in Chomsky normal form
generating L(G) – {^}.
G has the productions:
(1) S → AaA | CA | BaB A → aaBa | CDA | aa | DC
B → bB | bAB | bb | aS C → Ca | bC | D D → bD |^
(2) S → SS | (S) |^
(3) S → S(S) |^

9. Convert following CFG to equivalent Chomsky Normal Form(CNF).


S -> AACD | ACD | AAC | CD | AC | C
A -> aAb | ab
C -> aC | a
D -> aDa | bDb | aa | bb

Unit 5: Pushdown Automata and CFL:


r
1. For the language L = { xcx / x Є {a,b}* } design a PDA(Push Down Automata) and trace it
for string “bacab”.
2. Design and draw a deterministic PDA accepting strings with more a’s than b’s. Trace it for
the string “abbabaa”.
3. Design and draw a deterministic PDA accepting “Balanced strings of Brackets” which
are accepted by following CFG. S -> SS | [ S ] | { S } | Λ
4. Define PDA and design PDA for L = { x ∈ { a, b}* | na(x) > nb(x) }
5. Give transition table for deterministic PDA recognizing the following language.
n n+m m
{a b a | n, m ≥ 0)
Unit 6: Turing Machine (TM):
1. Draw a Turing Machine(TM) to accept Palindromes over {a,b}. (Even as well as Odd
Palindromes)
2. Define Turing Machine. Describe its capabilities.
3. Draw the TM for L = {ss | s ∈ (a, b)*}
4. Explain Universal TM and Church Turing Thesis
5. Draw a transition diagram for a Turing machine accepting the following language.
{ an bn cn | n ≥ 0 }
6. Explain in Brief:Halting Problem

Unit 7: Computable Functions:


1. Differentiate the NP Hard and NP Complete Problems.
2. Explain in Brief:Basic Complexity Classes.
3. Write short notes on the following:
(a) The Primitive Recursive Functions.
(b) The Sets P, NP, PSpace and NPSpace.
(c) Top Down Parsing And Bottom Up Parsing
4. Explain the following
1. Primitive Recursive Operation & Function.
2. μ Recursive Functions.
5. Explain unbounded minimization and μ recursive functions
6. Prove that following add(x,y) = x+y is primitive recursive function.
7. Give definitions of the following.
(a) Polynomial-time Reducibility
(b) P,NP,NP-hard and NP-complete
******

You might also like