0% found this document useful (0 votes)
35 views18 pages

Unitwise Two Mark Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views18 pages

Unitwise Two Mark Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18

UNIT I - Formal Languages and Finite Automata

2 Mark Questions and Answers:

1.Define Deterministic Finite Automata.


The finite automata are called DFA if there is only one path for a specific input from current state to next
state. A finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F).
where Q is a finite set of states, which is non-empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.

2.Define Non-Deterministic Finite Automata.


The finite automata are called NFA when there exists many paths for a specific input from current state
to next state. A finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F ).
where Q is a finite set of states, which is non-empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.

3.Design FA which accepts odd number of 1’s and any number of 0’s
4.Design FA to accept the string that always ends with 00

5.State the difference between NFA & DFA


S.No NFA DFA
1 For each input symbol there is For each input symbol there is
exactly one transition out of one or more transition from a
each state. state on the same input
symbol.
2 It doesn‘t allow ξ moves It allows ξ moves
3 1. δ(q,ξ) =q 1.δ(q,ξ) =q
2. δ(q,wa) = δ(δ`(q,w),a) 2. δ(q,wa) = δ(δ`(q,w),a)
3. δ(p,x) = U δ(q,w) q in p
4 Every DFA can simulate as NFA can‘t simulate as DFA
NFA
5 Transition function mapping Transition function mapping
from Q ∑ to Q. from Q ∑ to 2 Q

6.Draw a NFA to accept strings containing the substring 0101.

7.Find ε-closure(q) for the following FA.


8.Design DFA for the language over {a, b}* such that length of the string |w| is divisible by 5
i.e, |w| mod 5 = 0

Q = {q0,q1,q2,q3,q4}
 = {a,b}
q0 = q0
F= { q0}

9.Draw NFA for the language over {0, 1}* for the set of all strings that ends with 1?

Q = {A,B}
 = {0,1}
q0 = A
F= { B}

 0 1
A {A} {A,B}
*B  

10. Find the ε-closure(q) for the following Finite Automata?


ε-closure(1)= {1,2,5,6,7}
ε-closure(2)={2}
ε-closure(3)={3}
ε-closure(4)={4}
ε-closure(5)={5,6,7}
ε-closure(6)={6}
ε-closure(7)={7}
ε-closure(8)={1,2,5,6,7,8}

11.Find FA which accepts even number of 0’s and even number of 1’s

12.Find NFA accepting all strings ending with 01. Over 

13.Illustrate the language given by following DFA

14.Find a DFA,the language recognized by the automaton being L }

15.Write short notes on Minimization of DFA?


- Reducing the number of states from given FA
- First find out which two states are equivalent we than replace those two states by one representative
state.
- For finding the equivalent states we will apply the following rule
- The two states S1 & S2 are equivalent if and only if both the states are final or non-final states
16.Find set of strings accepted by the finite automata.

Set of strings accepted by given finite automata are


S=

17.Draw the transition diagram (automata) for an identifier.

18.Draw state transition diagram for FA over {a,b} containing substring aabb.

19.Construct NFA accepting binary strings with two consecutive 0’s.

20.Construct the DFA to accept the language L={w|w is of even length and begins with 11}

UNIT II – Regular Languages and Expressions

1. What is Regular Language & Regular Expression?


The language accepted by M is L(M) is the set {x | δ(q0,x)is in F}. A language is regular if it is
accepted by some finite automaton.

Let Σ be an alphabet. The regular


expression over Σ and the sets they denote are:
i. Φ is a r.e and denotes empty set. ii. Є is a r.e and denotes the set {Є}
iii. For each ‘a’ in Σ , a+ is a r.e and denotes the set {a}.
iv. If ‘r’ and ‘s’ are r.e denoting the languages R and S respectively then (r+s),
(rs) and (r*) are r.e that denote the sets RUS, RS and R* respectively.

2. Differentiate L* and L+

L* L+
L* denotes Kleene closure and is given by L+ denotes Positive closure and is given by L+= U
L* =U Li Li
i=0 i=1 example:0+={0,00,000,
example : 0* ={Є ,0,00,000,………} ……………………………………..}
Language includes empty words also.

3.What is Arden’s Theorem?


Arden’s theorem helps in checking the equivalence of two regular expressions. Let P and Q be
the two regular expressions over the input alphabet Σ. The regular expression R is given as :
R=Q+RP
Which has a unique solution as R=QP*.

4. Construct a r.e for the language over the set Σ={a,b} in which total number of a’s are
divisible by 3?
( b* a b* a b* a b*)*

5. what is: (i) (0+1)* (ii)(01)* (iii)(0+1) (iv)(0+1)+


(0+1)* { Є , 0 , 1 , 01 , 10 ,001 ,101 ,101001,…………………}
Any combinations of 0’s and 1’s.
(01)*={Є , 01 ,0101 ,010101 ,…………………………………..}
All combinations with the pattern 01. (0+1)= 0 or 1,No other possibilities.
(0+1)+= {0,1,01,10,1000,0101,………………………………….}

6. What is the closure property of regular sets?


The regular sets are closed under union, concatenation and Kleene closure. r1Ur2= r1 +r2
r1.r2= r1r2 ( r )*=r*
The class of regular sets are closed under complementation, substitution, homomorphism and
inverse homomorphism.

7. Reg exp for:


(i)All strings over {0,1} with the substring ‘0101’
(ii)All strings Beginning with ‘11’ and ending with ‘ab’
(iii)Set of all strings over {a,b}with 3 consecutive b’s.
(iv)Set of all strings that end with ‘1’and has no substring ‘00’
(i)(0+1)* 0101(0+1)* (ii)11(1+a+b)* ab
(iii)(a+b)* bbb (a+b)* (iv)(1+01)* (10+11)* 1

8. Reg exp denoting a language over Σ ={1} having (i)even length of string (ii)odd length of a
string
(i) Even length of string R=(11)*
(ii) Odd length of the string R=1(11)*

9. Construct a r.e for the language whch accepts all strings with atleast two c’s over the
set Σ={c,b}
(b+c)* c (b+c)* c (b+c)*

10. What are the applications of pumping lemma?


Pumping lemma is used to check if a language is regular or not.
(i) Assume that the language(L) is regular.
(ii) Select a constant ‘n’.
(iii) Select a string(z) in L, such that |z|>n.
(iv) Split the word z into u,v and w such that |uv|<=n and |v|>=1.
(v)You achieve a contradiction to pumping lemma that there exists an ‘I’
Such that uviw is not in L.Then L is not a regular language.

11. What is the closure property of regular sets?


The regular sets are closed under union, concatenation and Kleene closure. r1Ur2= r1 +r2
r1.r2= r1r2 ( r )*=r*
The class of regular sets are closed under complementation, substitution, homomorphism and
inverse homomorphism.

12.Generate NFA-ε to represent a* b|c

13.Write the regular expression for thset of strings over{0,1} that have atleast one.
r.e=(0*1+) (0+1) *
because 1+=11* That meansat least one 1 is always present in regular expression.

14.Construct a finite automation for the regular expression 0*1*


15.Find the language accepted by the following automation

The r.e that can be obtained from given DFA is


r.e=0*1*
That means the strings accepted by FA will be any number of 0’s followed by any number of 1’s. Any
number means it can be zeras well.

16. Construct a DFA for the regular expression aa*bb*


The DFA for aa*bb* is-
The state q0 is a start state and state q2 is a final state.

17. What is {10,11}*?(Write atleast first seven terms).


The {10 +11}* is a set containing the strings of any combination of 10 and 11. This set also contains ε or
null string.
The items of this set are
{ε,10,11,1010,1011,1111,1110,111111,101010,……}

18. Design FA that accepts {0,1}+.

UNIT-III
CONTEXT FREEGRAMMAR
UNIT-IV
TURING MACHINE
UNIT – V

You might also like