Sei sulla pagina 1di 2

TCS TUTORIAL QUESTIONS FOR PRACTICE

FSM
1. Design FSM to check whether the given binary number is divisible by 3.
2. Design FSM in which the input is valid if it ends in “100” over the Ʃ={0,1}.
3. Design FSM in which the input is valid if it ends either in “100” or “110” over the
Ʃ={0,1}.
4. Design FSM in which the input is valid if it does not contains any occurrences of 3
consecutive b’s over the Ʃ={a,b}.
5. Design FSM in which the input is valid if it ends in “babb” over the Ʃ={a,b}.
6. Design FSM in which the input is valid if it either ends in “xyy” or “yxx” over the
Ʃ={x,y}.

NFA - DFA
I. Convert the following Regular Expressions into NFA:
1. r = (11+110)*.0
2. r = aa.(a+b)*.b
3. r = aba.(a+b)*
4. r = (ab|ba)*|(aa|bb)*
5. r = (ab)*
6. r = (a*b*+(ab)*)
7. For the language which ends in either “01” or “101” over the Ʃ={0,1}.
II. Convert the following NFA to an equivalent DFA:

State A B ε
→ q0 {q0,q1} {q1} {}
q1 {q2} {q1,q2} {}
q2* {q0} {q2} {q1}

III Convert (0+ε).(10)*.(ε+1) into NFA with ε-moves and hence obtain a DFA.moves and hence obtain a DFA.
IV Design DFA for recognizing the strings that contains “010” as substring over the
Ʃ={0,1}.
V Design DFA which accepts set of strings which contains “00” as substring but does not
contain “000” as substring.
VI Design DFA that accepts the language represented by 0*1*2* over the Ʃ={0,1}..
VII Design DFA which is used to recognize the language in which every “a” is followed by
“b” over the Ʃ={a,b}.
VIII Design minimized DFA for accepting strings ending in “100” over the Ʃ={0,1}.
IX Design DFA to accept strings over the Ʃ={a,b} such that it begins with “aa” but not ends
in “aa”.
X Design DFA for the following language:
L = {w | every odd position of w is 1}.
MOORE – MEALY
1. Design Moore Machine to change each occurrences of “aba” to “abb” over the Ʃ={a,b}.
2. Design Moore and Mealy Machine to find the 1’s Complement of a binary number.
3. Design Mealy Machine to find 2’s Complement of a binary number and convert it to
Moore Machine.
4. Design Mealy Machine to implement the increment of a binary number and convert it to
Moore Machine.
5. Design Mealy Machine to implement the decrement of a binary number and convert it to
Moore Machine.
6. Design Mealy Machine to implement the binary adder and convert it to Moore Machine.
7. Design Moore Machine for the input from (0+1+2)* which prints the residue modulo 5 of
the input treated as ternary number.