0% found this document useful (0 votes)
36 views

Solutions To Set 6

The document contains 22 multiple choice questions about theory of computation topics like automata theory and formal languages. The questions test understanding of concepts like regular expressions, finite automata, pushdown automata, Turing machines, regular languages, context-free languages and recursively enumerable languages. The solutions and explanations provided analyze each question and justify the correct answer choice.
Copyright
© © All Rights Reserved
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)
36 views

Solutions To Set 6

The document contains 22 multiple choice questions about theory of computation topics like automata theory and formal languages. The questions test understanding of concepts like regular expressions, finite automata, pushdown automata, Turing machines, regular languages, context-free languages and recursively enumerable languages. The solutions and explanations provided analyze each question and justify the correct answer choice.
Copyright
© © All Rights Reserved
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/ 8

THEORY OF COMPUTATION

SOLUTIONS
1. Consider this R.E. = (0 + 1)* (00 + 11)
What will be the number of states in minimal DFA and NFA?

(a) DFA – 5, NFA – 5 (b) DFA – 5, NFA – 4


(c) DFA – 4, NFA – 4 (d) None

Solution: Option (b)

Explanation:

2. Number of states in minimal DFA to accept the language (a + aaa)* over Ʃ = {a, b} ?

(a) 1 (b) 2
(c) 3 (d) None

Solution: Option (b)

Explanation:
(a + aaa)* ≡ a*

3. Consider the following statements:

1
S1: There doesn’t exist FA for every CFL.
S2: Let Ʃ = {a, b} and L = {an w an | n ≥ 1, w ∈ Ʃ*}. Then L is context free but not regular.

(a) Both are True (b) Both are False


(c) S1 → True, S2 → False (d) S1 → False, S2 →True

Solution: Option (c)

Explanation:
S1: Consider L1 = {anbn | n ≥ 1}, is a CFL but not Regular.
S2: We can consider the language as set of strings starting and ending with a, since w is known to
be in Ʃ*, considering everything after first a and before last a as w.
So, it is regular.

4. Consider the following statements:

S1: r1 = (ԑ + a + b)100 represents strings of length strictly less than 100.


S2: r2 = (00 + 11 + 01 + 10)* (0 + 1) represents all odd length strings.

(a) Both are True (b) Both are False


(c) S1 → True, S2 → False (d) S1 → False, S2 →True

Solution: Option (d)

Explanation:
S1 → F
S2 → T
r1 represents strings of length atmost 100.

5. r1 = (01 + 1)* (ԑ + 0)
r2 = (0 + ԑ) (10 + 1)*

(a) Both represent same language

(b) r1 represents strings with no consecutive 00 and


r2 represents strings with no consecutive 11.

(c) r1 represents strings with no consecutive 11 and


r2 represents strings with no consecutive 00.

(d) None of above.

2
Solution: Option (a)

Explanation:
Both are regular expression represents strings with no consecutive zeroes.

6. What will be number of states in DFA to represent the regular expression r1 = (01 + 1)* (ԑ +
0)?

(a) 2 (b) 3
(c) 4 (d) 5

Solution: Option (b)

Explanation:
Let us consider the DFA for the language that accepts all the strings with consecutive 0’s.

The complement this DFA is the DFA for r1.

7. S1: A non-deterministic TM can decide languages that a standard TM cannot decide.


S2: L be a context free language. 𝐿̅ is turing-decidable.

(a) Both are True (b) Both are False


(c) S1 → True, S2 → False (d) S1 → False, S2 →True

Solution: Option (d)

Explanation:
S1: NTM ≡ DTM
S2: 𝐿̅ is Recursive.

8. L = {ai bj ck dm} | i+j+k+m is multiple of 13}

L is ?

(a) Regular (b) Context-free


(c) Turing-decidable (d) Turing-Recognizable

3
Solution: Option (a)

Explanation:
We just need 13 states to remainders (0, 1, . . . 12). We start by state with 0 remainder and as we
visit new character, we change state to next remainder.

9. Language L = {an bn w | n ≥ 0, w ∈ {c, d}*, |w| = n} is

(a) Regular (b) DCFL


(c) NCFL (d) Not context-free

Solution: Option (d)

Explanation:
Not possible to check for w as stack will be empty after checking for a and b.

10. Which of the following is true for i/p alphabet Ʃ and tape alphabet Γ of a standard TM?

(a) It is possible for Ʃ and Γ to be equal


(b) Γ is always a strict superset of Ʃ
(c) It is possible for Ʃ and Γ to be disjoint
(d) None

Solution: Option (b)

Explanation:
Γ always contains members of Ʃ and special Block symbol also, which is not in Ʃ.

11. If L1 and L2 are Turing-Recognizable then L1 ∪ L2 will be

(a) Decidable
(b) Turing-recognizable but may not be decidable
(c) May not be Turing recognizable
(d) None of above

Solution: Option (b)

Explanation:
We can build a TM for union but decidability may not always be guaranteed.

4
12.

Consider u = abbaba
v = bab
w = aabb

(a) It accepts u, v but not w (b) It accepts all


(c) It rejects all (d) It rejects u only

Solution: Option (b)

13. Consider the CFG:


S → aSa | bSb | a | b | ∈

Which of following strings is NOT guaranteed by grammar?

(a) aaaa (b) baba


(c) abba (d) babaaabab

Solution: Option (b)

Explanation:
The grammar generates all palindromes with alphabet {a,b}

14. R.E. best describing this below NFA?

(a) (a + b)* a (a + b) b (b) (a + b)+ a (a + b) b


(c) (a + b)* a (a + b) b(a + b)* (d) (a + b)*

Solution: Option (a)

5
Explanation:
⊛ (b) is not because aab is rejected.

15. Let L be CFL and M a regular language. Language L ⋂ M is always

(a) always regular (b) never regular


(c) always DCFL (d) always context free language

Solution: Option (d)

16. Which of the following is accepted by NPDA but Not by DPDA?

(a) {an bn cn | n ≥ 0} (b) {an bn | n ≥ 0}


(c) {an bm | m, n ≥ 0} (d) {al bm cn | l ≠ m or m ≠ n}

Solution: Option (d)

Explanation:
(a) is CSL.
(b) & (c) are accepted by DPDA.

17. Which of the following statements about regular languages is Not true?

(a) Every language has a regular subset


(b) Every language has a regular superset
(c) Every subset of regular language is regular
(d) Every subset of finite language is regular

Solution: Option (c)

Consider L = 0*1*, which is regular, L1 = {0n1n, n>1} is a subset of L but not regular.

18. Consider the CFG below:

S → aSAb | ԑ
A → bA | ԑ

Grammar generates:

(a) (a + b)* · b (b) am bn | m ≤ n


(c) am bn | m = n (d) a* b*

6
Solution: Option (b)

Explanation:
Verify using aab. It is getting rejected.

19. Consider regular grammar:

S → bS | aA | ԑ
A → aS | bA

Myhill-Nerode equivalence classes for language generated by grammar are

(a) {w ∈ (a + b)* | #a (w) is even} and {w ∈ (a + b)* | #a (w) is odd}


(b) {w ∈ (a + b)* | #b (w) is even} and {w ∈ (a + b)* | #b (w) is odd}
(c) {w ∈ (a + b)* | #a (w) = #b (w)} and {w ∈ (a + b)* | #a (u) ≠ #b (w)}
(d) {ԑ}, {wa | w ∈ (a + b)* and wb | w ∈ (a + b)*}

Solution: Option (a)

Explanation:
M – N equivalent classes are actually the number of states in FA.

20. L ⊆ Ʃ*, Ʃ = {a, b} Which of the following is True?

(a) L = {x | x has equal a’s and b’s} is regular


(b) L = {an bn | n ≥ 1} is regular
(c) L = {x | x has more a’s than b’s} is regular
(d) L = { am bn, m,n ≥ 1} is regular

Solution: Option (d)

21. Which of the following R.E. are equivalent?

i. (00)* (ԑ + 0)
ii. (00)*
iii. 0*
iv. 0(00)*

(a) i and ii (b) ii and iii


(c) i and iii (d) iii and iv

Solution: Option (c)

7
Explanation:

(ii) does not generate strings of odd length


(iv) does not generate ԑ
(i) and (iii) generate 0*.

22. Define init (L) = {set of all prefixes of L}


Let L = {w | w has equal number of 0’s and 1’s}, Ʃ = {0,1}

init (L) is:

(a) all binary strings with unequal number of 0’s and 1’s

(b) all binary strings with ԑ-string

(c) all binary strings with exactly 1 more 0’s than the number of 1’s
or one more than number of 0’s

(d) None of above

Solution: Option (b)

Explanation:
init (L) = (0+1)*

You might also like