GATE
CS & IT Weekly Test-03
Theory of Computation
Q1 Which of the following is a regular language?
n
(A) L = {a
n
∣
∣n ≥ 1}
n
(B) L = {a
m
∣
∣n ≥
2
1, m = n }
n
(C) L = {a
m
∣
∣n ≥ 1, m > n}
(D) None of these
Q2 Which of the following is a non-regular
language?
(A) L = {wxwy | x,y,w∈(a + b)+}.
The correct transition of δ*(S, abaab) is?
(B) L = {xwyw | x,y,w∈ (a + b)+}.
(A) {D}
(C) L = {wxyw | x,y,w∈(a + b)+}.
(B) {S, A, B, D}
(D) All of the above.
(C) {A, B, A, D, D}
Q3 Let L be any formal language. If L* is regular (D) {B, D}
language then what is L?
Q6 Assume R1, R2 and R3 are three regular
(A) L is regular.
expressions.
(B) L is non-regular.
Given, R1 + R2R3 = (R1 + R2) (R1 + R3) for any R2
(C) L is CFL.
and R3. Which of the following could be correct
(D) None of these.
condition which always satisfies the above
Q4 Consider the following two statements: equation?
[I]: There exist a regular language L1, such that (i) R1 = R2
for all language L2, L1 ∪ L2 is always regular. (ii) R1 = R3
[II]: If all states of deterministic finite automata (iii) R1 = ϕ
(DFA) except start state are final states then (A) Only (i) and (ii) are correct.
language accepted by DFA is ∑ .
+
(B) Only (i) and (iii) are correct.
Which of the following is correct? (C) Only (ii) and (iii) are correct.
(A) S1 only. (D) (i), (ii) and (iii) are correct.
(B) S2 only.
Q7 Consider the following statements:
(C) Both S1 and S2 are true.
[I]: Concatenation of two finite language
(D) None of these.
cannot be commutative until at least one of
Q5 Consider the following DFA: them is empty or null.
[II]: Let L be language, reversal of L does not
contain any string present in language L except
∈ .
Which of the following is correct?
(A) (I) only.
(B) (II) only.
Android App | iOS App | PW Website
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 1/5
GATE
(C) Both (I) and (II) are correct.
(D) None of these.
Q8 Let us consider the following regular expression
R = a* b * + b * a * .
How many equivalence classes of expression
that represent language are equivalent to
regular expression R?
Q9 Consider the following languages:
L1 = {ambncp | m, n, p ≥ 0}.
L2 = {ambmcp | m, p≥ 0}.
L3 = {a2mb2mcp | m, p≥ 0}.
Which of the following is/are correct?
(A) L1 ⊆ L2 and L2 ⊆ L1.
(B) L2 ⊆ L1 and L3 ⊆ L1.
(C) L3 ⊆ L2 and L2 ⊆ L1.
(D) L2 ⊆ L3 and L3 ⊆ L1
Q10 Consider the following languages L1 and L2:
L1 = {0m1n | m = n, m, n ≥0}
L2 = {0m1n | m, n ≥ 0}
Let, L = L2 – L1, then what is the language L?
(A) L = {0m1n | m, n≥ 0}.
(B) L is regular
(C) L = {0m1n | m ≠ n}, non-regular.
(D) L = {0m1n | m≠ n }, regular.
Android App | iOS App | PW Website
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 2/5
GATE
Answer Key
Q1 (C) Q6 (D)
Q2 (C) Q7 (D)
Q3 (D) Q8 6 to 6
Q4 (A) Q9 (B, C)
Q5 (C) Q10 (C)
Android App | iOS App | PW Website
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 3/5
GATE
Hints & Solutions
Q1 Text Solution:
Q5 Text Solution:
n
m
L = {a ∣
∣n ≥ 1, m > n}
⇒ L = {a
m
1
∣m ≥ 2}
δ *(S, abaab) = a b a a b
∣
ABADD
2
m
∪ {a ∣m
∣ ≥ 3} ∪ ... So, answer will be (c)
⇒ L = {a ∣
∣i
i
≥ 2} is a regular language.
DFA: Q6 Text Solution:
R1 + R2R3 = (R1 + R2) (R1 + R3)
(i) If R1 = R2,
R1 + R2R3 = (R1 + R2)(R1 + R3)
R2 + R2R3 = (R2 + R2)(R2 + R3)
R2 + R2R3 = R2(R2 + R3)
This DFA will accept the language. So, this is
= R2 + R2R3 is correct.
regular for remaining language DFA not
(ii) If R1 = R3,
possible.
R1 + R2R3 = (R1 + R2)(R1 + R3)
R3 + R2R3 = (R3 + R2)(R3 + R3)
Q2 Text Solution:
= (R2 + R3)R3
(a) L = {wxwy | x,y,w∈(a+b)+}
= R3 + R2R3 is correct.
L = [a(a + b)+ a(a + b)+] + [b(a + b)+ b(a + b)+]
(iii) If R1 = ϕ,
⇒ L is regular language.
R1 + R2R3 = (R1 + R2)(R1 + R3)
(b) L = {xwyw | x,y,w∈(a + b)+}
ϕ + R2R3 = (ϕ + R2)(ϕ+ R3)
L = [(a + b)+ a(a + b)+a] + [(a + b)+ b(a + b)+b]
R2R3 = R2 R3 is correct.
⇒ L is regular language.
∴ (i) , (ii) and (iii) conditions are correct.
(c) L = {wxyw | x,y,w∈(a + b)+}
⇒ L is non-regular language.
Q7 Text Solution:
[I]: L1 = {a}
Q3 Text Solution:
L2 = {a}
If L* is regular, L may or may not be a regular.
L1 ⋅ L2 = a ⋅ a
Example 1: L* = (a + b)* is regular, L = (a + b) is
L2 ⋅ L1 = a ⋅ a
regular.
Commutative
Example 2: L* = {(aP)* | P is prime} is regular but
[II]: L = (a + b)*
L = {aP | P is prime} is non-regular.
LR = (a + b)*
∴ Option (d) is correct.
Hence, option (d) is correct.
Q4 Text Solution:
Q8 Text Solution:
S1 True:
*
R = a* b * + b * a *
L1 = ∑
* *
L1 ∪ L 2 = ∑ ∪ L2 = ∑ (Regular)
S2 False:
May or may not be ∑
+
For example: DFA for language ending with “a”
on alphabet {a, b}.
Android App | iOS App | PW Website
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 4/5
GATE
R = a* b * + b * a *
= (∈ + aa*) = (∈+ bb*) + (∈ + bb*) (∈+ aa*)
= ∈ + aa* + bb* + aa* bb* + bb* aa*
[∵ a* = (∈ + aa*)]
Number of equivalence classes are
equivalent to minimum number of states in DFA.
Regular expression for each state represents
each equivalence class.
So,
[q0] = ∈
[q1] = aa*
[q2] = bb*
[q3] = aa* + bb*
[q4] = bb* aa*
[q5] = (aa*bb*a + bb*aa*b) (a + b)*
Q9 Text Solution:
L3 ⊆ L1 True
L2 ⊆ L1 True
L3 ⊆ L2 True
(a) False (b) True
(c) True (d) False
Q10 Text Solution:
L1 = {0m1n | m = n, m, n ≥0}
L2 = {0m1n | m, n≥ 0}
L = L 2 – L1
= L2 ∩ ¯
¯¯¯
L1
= (0*1*) ∩ {0m1n | m ≠ n}
= {0m1n | m ≠ n} non-regular (CFL)
Android App | iOS App | PW Website
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 5/5