You are on page 1of 1

National Institute of Technology Rourkela

Department of Computer Science and Engineering


B.Tech/Dual Degree 5th Semester, Mid-Semester Examination (Autumn) 2017
Subject: Theory of Computation Subject Code: CS 331
Full Marks: 30 Duration: 2 Hours
Answer any FIVE questions.
Figures at the right margin indicate marks.
All parts of a question must be answered at one place.
1. Draw the DFAs for the following languages over the alphabet Σ = {0, 1} [6]
(a) all strings except those containing the substring 001.
(b) all strings with no more than three 1s.
(c) all strings in which the number of 0’s is divisible by 3 and number of 1’s is divisible by 2.
(d) every string has each 0 followed by a 1.
(e) all strings that ends with either 01 or 11.
(f) all strings whose binary equivalent is divisible by 2.
2. (a) Construct a Moore machine that determines whether an input string contains an even or odd
number of 1’s. The machine should give 1 as output if an even number of 1’s are in the string and
0 as output if an odd number of 1’s are in the string. Also, find its equivalent Mealy machine. [3]
(b) Construct a Mealy machine that determines whether the input string has a 1 in the last position
and a 0 in the third to the last position read so far. Also, find its equivalent Moore machine. [3]
3. (a) Find the ∈-NFA for the regular expression 0(0∗ + 1)1∗ . [2]
(b) Eliminate the ∈-transitions for the above constructed ∈-NFA and further, find the equivalent DFA
with minimum number of states possible. [4]
4. (a) Determine the language recognized by the NFA shown in Figure 1. [2]

1
S0 0 S1 S2

0 1

Figure 1:
Figure 2:

(b) Find the equivalent DFA of Figure 1. Is your DFA can further be minimized? If, yes then find the
equivalent DFA with less number of states. [4]
5. (a) Proof that if L1 and L2 are two regular languages then (L1 ∪ L2 )∗ = (L∗1 L∗2 )∗ [2]
(b) Write a regular expression for a set of strings of 0’s and 1’s with even number of 0’s. Further,
construct the DFA. [4]
6. (a) Proof that if L1 and L2 are two regular languages then (L1 L2 )∗ L1 = L1 (L2 L1 )∗ [2]
(b) State Arden’s theorem. Find the regular expression for the language recognized by the DFA given
in Figure 2 using Arden’s theorem or state elimination method? [4]
———— END ————

NITR/CS/RKM/AN/CS331/MID/2017

You might also like