All mock tests are FREE till 31 December — register to save your progress
UGC NET · PAPER 2

UGC NET Paper 2 Computer Science – Unit 8: Theory of Computation and Compilers PYQ (September 2022)

11 questions · answer key at the end · updated 11 Oct 2026
Q12. The reduced grammar equivalent to the grammar whose production rules are given below is
S → AB | CA
B → BC | AB
A → a
C → aB | b
  1. S → CA, A → a, C → b
  2. S → CA | B, B → BC | B, A → a, C → aB | b
  3. S → CA | B, B → BC, A → a, C → aB | b
  4. S → AB | AC, B → BC | BA, A → a, C → aB | b
Answer & explanation →
Q13. Consider the production rules of grammar G:
S → AbB
A → aAb | λ
B → bB | λ
Which language L is generated by G?
  1. L = {anbm : n ≥ 0, m > n}
  2. L = {anbm : n ≥ 0, m ≥ 0}
  3. L = {anbm : n ≥ m}
  4. L = {anbm : n ≥ m, m > 0}
Answer & explanation →
Q14. Consider the language L = {anbm : n ≥ 4, m ≤ 3}. Which regular expression represents L?
  1. aaaa*(λ + b + bb + bbb)
  2. aaaaa*(b + bb + bbb)
  3. aaaaa*(λ + b + bb + bbb)
  4. aaaa*(b + bb + bbb)
Answer & explanation →
Q15. Consider L = {ab, aa, baa}. Which of the following strings is NOT in L*?
  1. baaaaabaaaaa
  2. abaabaaabaa
  3. aaaabaaaa
  4. baaaaabaa
Answer & explanation →
Q16. Consider the NPDA M = ({q0, q1, qf}, {a, b}, {1, z}, δ, q0, z, {qf}) with
δ(q0, λ, z) = {(qf, z)}
δ(q0, a, z) = {(q1, 11z)}
δ(q1, a, 1) = {(q1, 111)}
δ(q1, b, 1) = {(q1, λ)}
δ(q1, λ, z) = {(qf, z)}
Which language L is accepted by the NPDA?
  1. L = {a2nbn : n ≥ 0}
  2. L = {anb2n : n ≥ 0}
  3. L = {a2nbn : n > 0}
  4. L = {anb2n : n > 0}
Answer & explanation →
Q65. Consider two instances X and Y of the Post Correspondence Problem, each with lists A and B of three strings over {0, 1}. Which of the following is true?

X

iList AList B
11111
21011110
3100

Y

iList AList B
110101
201111
3101011
  1. Only PCP in X has a solution
  2. Only PCP in Y has a solution
  3. PCP in both X and Y has a solution
  4. PCP in neither X nor Y has a solution
Answer & explanation →
Q66. Consider the following properties of recursively enumerable sets:
(A) Finiteness
(B) Context-freedom
(C) Emptiness
Which of the following is true?
  1. Only (A) and (B) are not decidable
  2. Only (B) and (C) are not decidable
  3. Only (C) and (A) are not decidable
  4. All of (A), (B) and (C) are not decidable
Answer & explanation →
Q69. Consider the grammar S → SbS | a and the string abababa. Consider the statements: the string has
(A) two parse trees
(B) two leftmost derivations
(C) two rightmost derivations
Which of the following is correct?
  1. All of (A), (B) and (C) are true
  2. Only (B) is true
  3. Only (C) is true
  4. Only (A) is true
Answer & explanation →
Q78. Match List I with List II.
Choose the correct answer from the options given below:
List IList II
A. Type 0I. Finite automata
B. Type 1II. Turing machine
C. Type 2III. Linear bounded automata
D. Type 3IV. Pushdown automata
  1. A-III, B-IV, C-II, D-I
  2. A-II, B-III, C-IV, D-I
  3. A-III, B-IV, C-I, D-II
  4. A-II, B-III, C-II, D-IV
Answer & explanation →
Q91. Consider the following statements:
Statement I: An LALR parser is more powerful than a canonical LR parser.
Statement II: An SLR parser is more powerful than LALR.
Which of the following is correct?
  1. Statement I true and Statement II false
  2. Statement I false and Statement II true
  3. Both Statement I and Statement II false
  4. Both Statement I and Statement II true
Answer & explanation →
Q92. Consider the following statements about context-free languages (CFL):
Statement I: CFLs are closed under homomorphism.
Statement II: CFLs are closed under complement.
Which of the following is correct?
  1. Statement I is true and Statement II is false
  2. Statement II is true and Statement I is false
  3. Both Statement I and Statement II are true
  4. Neither Statement I nor Statement II is true
Answer & explanation →

Answer key

  1. 12 – A
  2. 13 – A
  3. 14 – C
  4. 15 – A
  5. 16 – B
  6. 65 – A
  7. 66 – D
  8. 69 – A
  9. 78 – B
  10. 91 – C
  11. 92 – A