Вы находитесь на странице: 1из 2

Indian Statistical Institute

Semester-II 2012-2013
M.Tech.(CS) - First Year
Class Test I (8 February, 2013)
Subject: Automata, Languages and Computation
Total: 20 marks
Solutions
1. Suppose the following non-deterministic nite automaton (NFA) is converted to an equivalent
deterministic nite automaton (DFA) using the standard algorithm. [4]
..
q
0
.
start
.
q
1
.
q
2
.
0,1
.
0,1
.
0
.
1
Determine whether each of the following statements is true or false.
(a) ({q
1
}, 0) = {q
1
, q
2
}. false
(b) ({q
2
}, 0) = {}. (This was a typo; it should read ({q
2
}, 0) = .) true
(c) The state {q
0
, q
2
} is unreachable. true
(d) The state {q
0
, q
1
, q
2
} is a nal state. true
2. Write down the regular expression for hexadecimal numbers in C. [4]
Answer: 0
1
2
[xX]
1
[ 0-9
1
2
a-fA-F
1
] +
1
(-
1
2
if you used * instead of +)
3. The language L = {0
p
|p is prime } is not regular. If you have to prove this using the Pumping
Lemma, how many times should you pump v? Your answer should be in terms of the lengths of
u, v, w (u, v, w have their usual signicance). [6]
Answer: Let x = uvw L. Then uv
|x|+1
w L.
(Length of uv
|x|+1
w = |uvw| +|x||v| = |x|(1 +|v|), where |v| 1.)
For just the correct answer (proof missing / incorrect), you get 2 marks.
p.t.o.
1
4. Let M
1
= (Q
1
, ,
1
, q
(1)
0
, F
1
) and M
2
= (Q
2
, ,
2
, q
(2)
0
, F
2
) be two DFAs. Describe DFAs M

and M

that accept, respectively, L(M


1
) L(M
2
) and L(M
1
) L(M
2
). [6]
M

States (1 mark) (Q
1
Q
2
) for both
Alphabet for both
Transition (1 mark) ((q
1
, q
2
), a) = (
1
(q
1
, a),
2
(q
2
, a) for both
Initial state (1 mark) (q
(1)
0
, q
(2)
0
) for both
Final states (1.5 marks 2) (Q
1
F
2
) (F
1
Q
2
) F
1
F
2
2

Вам также может понравиться