Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

CLASS: T.E.

(COMP) SUBJECT: TCS


QUESTION BANK FOR TEST-I
(Academic Year 2018-19 Odd Sem)

NFA & DFA:

1) Write the comparison between NFA and DFA.


2) Construct an FA accepting all the strings over {0,1} ending in “010”.
3) Draw NFA to accept all strings that contain the substring 0101.
4) Draw FA for the following language over {0,1} :-
(i) All strings with even no. of 0’s and even no. of 1’s.
(ii) All strings of length at the most five.
5) Find the -closure of all states for following NFA, & convert the same into its equivalent DFA:

0  1

 1
q0 q1 q2

6) Design a FA to accept a binary string with odd no. of 1’s over {0,1}.
7) Design a FA for L={w  {0,1}* | w contains no more than one b}.
8) Design a FSM to accept a decimal number divisible by 4.
9) Construct NFA without  for following –NFA:

1,2 1 1,2

 
q0 q1 q2

10) For the following NFA find equivalent DFA –


11) For the following NFA find equivalent DFA –

12) Convert the following --NFA to NFA without  moves -

13) Convert the following --NFA to NFA without  moves –

14) Construct DFA equivalent to following NFA without -moves :


M= ( {q0, q1, q2}, {0,1},  , q0, {q2} )
where  is, (q0,0) ={q0,q1}, (q0,1) ={q2}, (q1,1) ={q1},
(q1,0) ={q0}, (q2,1) ={ q0,q1}

15) Consider the following NFA with - transitions & convert this to NFA without -moves &
then to DFA:
M = ( { q1,q2,q3,q4},{a,b},, q1,{q4} )
where,
 (q1,a)=q2,  (q1,)=q3,  (q2,)=q2,
 (q2,b)=q3,  (q3,a)=q3,  (q3,a)=q4,
 (q4,b)=q1,  (q4,b)=q4

Moore & Mealy Machines:


16) Distinguish between Moore and Mealy machines.
17) Give the formal definition of Mealy machine.
18) Design a Moore machine to convert each occurrence of substring “1000” by “1001”.
19) Design a Mealy machine for a binary input sequence such that if it has a substring “110” the
machine outputs ‘A’, if substring is “101” the machine outputs ‘B’, otherwise it outputs ‘C’.
20) Construct a Mealy machine that accepts strings ending with “00” & “11”. Convert the same to a
Moore machine.
21) Consider following Moore machine & construct equivalent Mealy machine for the same :

a,b
q0 /0 a q0 /1

b
a
b
q2/0

22) Design a Moore machine that will read sequence made up of letters A,E,I,O,U & will give as output
same sequence except that in these cases where an ‘I’ directly follows ‘E’, the output will change to
‘U’.
23) Design a Mealy machine that will read sequences made up of vowels of English language. It will give
the output in same sequences; except in the cases where a ‘U’ follows a ‘I’ , it will be changed to ‘E’.
24) Design a Moore & Mealy machine for mod 3 of a binary number.
25) Consider the following Mealy machine & convert it to Moore machine:

Next State
Present State a=0 a=1
State Output State Output
→ q1 q1 1 q2 0
q2 q4 1 q4 1
q3 q2 1 q3 1
q4 q3 0 q1 1

Regular Expressions:

26) Write regular expressions for the following languages:


a. ={0,1} containing all possible combinations of 0’s & 1’s but not having two consecutive
0’s.
b. The set of all strings of 0’s & 1’s such that every pair of adjacent 0’s appears before any
pair of adjacent 1’s.
c. The set of all strings over ={0,1} without length two.

27) Convert the following RE to -NFA:


(i) (1(00)*1+01*0)* (iii) (a+b)*.b
(ii) (0*1+1*0) (01)* (iv) 10.0*.1

28) Convert the RE in Q.27 to DFA.


29) Write the language recognized by the following REs:

(i) (0+1)*011 (iii) (a+b)*a(a+b)(a+b)


(ii) 1.(00+11)* (iv) (0+1)*.0.(0+1)*.0.(0+1)*

You might also like