0% found this document useful (0 votes)
792 views13 pages

TOC Model Question Paper Solution 1

This document contains a model question paper for the Theory of Computation subject. It has three questions with subparts: 1. Do as directed questions related to properties of regular languages, pumping lemma, equivalence relations etc. 2. Draw DFAs for certain regular expressions and prove that any NFA can be converted to an equivalent DFA. 3. Use pumping lemma to prove certain languages are non-regular, draw the DFA for set difference of two languages, and prove a property about states in a FA.

Uploaded by

THANGAMARI
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
792 views13 pages

TOC Model Question Paper Solution 1

This document contains a model question paper for the Theory of Computation subject. It has three questions with subparts: 1. Do as directed questions related to properties of regular languages, pumping lemma, equivalence relations etc. 2. Draw DFAs for certain regular expressions and prove that any NFA can be converted to an equivalent DFA. 3. Use pumping lemma to prove certain languages are non-regular, draw the DFA for set difference of two languages, and prove a property about states in a FA.

Uploaded by

THANGAMARI
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Roll No: ________

ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE


MODEL QUESTION PAPER I B.E. 6th Sem (CE)

SUB: Theory of Computation


Total Marks: 30 Time Allowed: 1:30 Hr

Q.1 Do as Directed. (a) True or false? Justify your answer. 1) Pumping lemma show that language is regular. Answer: False We cannot use pumping lemma to prove a language is regular. This is because the set of regular languages is a proper subset of the set of pumping languages, i.e. there are languages which satisfy the pumping condition but are nonregular. So even if we show that a language satisfies the pumping condition it does not imply that the language is regular. But since all regular languages satisfy the pumping condition, we can show that a language is not regular by showing that it does not satisfy the pumping condition. 2) The regular language is closed under Union and complement. Answer: True If L1 and L2 are regular language then L1L2 also regular ( by recursive definition of regular language (step 4)). To find complement of RL, all accepting state becomes non-accepting state and nonaccepting state becomes accepting states hence resultant complement language is also RL. 3) If L1 is nonregular, L2 is nonregular then L1 L2 is nonregular Answer: False The intersection of a nonregular language and its complement is empty and empty language is regular Ex. L1 =PAL L2= Complement of PAL So L1 L2 = and is a regular language, 4) The transition function : Q x 2Q is a Partial Function. Answer: False A partial function from X to Y is a function : X' Y, where X' is a subset of X. It generalizes the concept of a function by not forcing f to map every element of X to an element of Y (only some subset X' of X). But, in NFA it necessary that every element of domain must relates with at least one element of co-domain. 5) *= Answer: False * = { 0, 123, , } Here, 0 is a null string and remaining all elements are *=

(b) Do as Following (Any Two) 1) Show that the relation congruence modulo m over the set of positive integers is an equivalence relation.
Answer:

Assume that N = Set of all positive integers and m = given positive integer. For x, y N, x y (mod m) if and only if x y is divisible by m, i.e. x y = km, for k z.

2) Write the regular expression for All strings of 0s and 1s having even number of 0s and odd number of 1s.

3) Prove that following functions is a bijection from R to R and find f -1.


f (x) = (x 2 +1) / (x 2 + 4)

Answer: In order to prove that function is bijection, we have to prove that it is one to one and onto function: Prove that function is one to one: Let x1 and x2 be two real number such that f(x1) = f(x2) (x12 + 1)/ (x12 + 4) = (x22 + 1)/ (x22 + 4) x12 x22 + 4x12 + x22 + 4 = x12 x22 + x12 + 4x22 + 4 3x12 = 3x22 x1 2 = x2 2 x1 = x2 Hence f is one to one function. 2

Prove that function is on onto: Let y be a real number such that some x R, f(x) = y. (x 2 +1) / (x 2 + 4) = y (x 2 +1) = y(x 2 + 4) x 2 +1 = yx 2 + 4y (1-y) x 2 = 4y-1 x= (4y-1)/(1-y) ) now, put value of x into f(x) (x 2 +1) / (x 2 + 4) = (( (4y (4y-1)/(1-y) ) + 1) / (( (4y-1)/(1-y) ) + 4) = (4y- + 1-y) / (4y-1+4-4y) -1 = 3y/3 =y Hence, f is onto function So, f is bijection function And f-1 (y) = (4y-1)/(1-y) Q.2 Do a Following (a) Draw a DFA for following (Any two) 1. (1+01)*(0+^)

2. (00+11+(01+10)(00+11)*(01+10))*

3. All strings of 0s and 1s have length at most 5.

b) Prove that for any NFA M =<Q, , q0, A, > accepting language L *, there is a DFA M1= *, <Q1, , q1, A1, 1> that also accepts L.

Answer

Q.3 Do as directed. (Any two) (a) Use pumping lemma to show that following language is nonregular.(Any One) 1) The set of even-length strings over {0,1} with the two middle symbols are equal. Proof: We prove this by proof by contradiction. Suppose L is regular. Let n be an integer in theorem 5.2a. Let x = 0n001n where |x| n. Theorem say that x=uvw where some string u,v and w satisfying following condition |uv| n (1) |v| > 0 (2) and for any m 0, uvmw L (3) let uv = 0k (for some k, all first occurrence of 0s except middle 00). so, v =0j where j > 0 (by condition 2) let m=2 uvmw = uv2w = uvvw = 0n0j 001n = 0n+j 001n L because n+j n since j>0 so, our assumption is wrong. L is not regular language 2) L = {x {0, 1}* | no prefix of x has more 0s then 1s} Proof: We prove this by proof by contradiction. Suppose L is regular. Let n be an integer in theorem 5.2a. Let x = 0n1n where |x| n. Theorem say that x=uvw where some string u,v and w satisfying following condition |uv| n (1) |v| > 0 (2) and for any m 0, uvmw L (3) let uv = 0k (for some k, all first occurrence of all 0s). so, v =0j where j > 0 (by condition 2) let m=2 uvmw = uv2w = uvvw = 0n0j 1n = 0n+j 1n L because n+j n since j>0 so, our assumption is wrong. L is not regular language b) Let M1 and M2 be the two FAs as given below.

Draw FA recognizing (L1 - L2) where L1 and L2 correspond to M1 and M2 respectively. Answer

10

c) Suppose M is the finite automata (Q, , q0, A, ). Show that if for some state q, (q, a) = q, then *(q, x) = q for every x *. Answer:

11

12

13

You might also like