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 (June 2023)

9 questions · answer key at the end · updated 11 Oct 2026
Q25. Consider a finite automaton F1 with three states C (start), S and E (final), in which there are transitions in both directions between every pair of states (C ⇄ S, S ⇄ E, C ⇄ E). Let F2 be the finite automaton obtained by reversal of F1. Which of the following is correct?
  1. L(F1) ≠ L(F2)
  2. L(F1) = L(F2)
  3. L(F1) ≤ L(F2)
  4. L(F1) ≥ L(F2)
Answer & explanation →
Q34. The maximum yield length of the following CNF CFG is
S → AB
A → CD
B → e
C → a
D → b
  1. 8
  2. 7
  3. 4
  4. 5
Answer & explanation →
Q40. Consider the language L = {w ∈ {a, b, c}* : nₐ(w) + n_b(w) = n_c(w)}. L is
  1. Context free but not linear
  2. Not context free
  3. Context free and linear
  4. Linear
Answer & explanation →
Q48. Consider the following statements:
A. A context-free language is generated by an LR(0) grammar if and only if it is accepted by a deterministic pushdown automaton and has the prefix property.
B. If M1 is a single-tape TM simulating a multitape TM M, then the time taken by M1 to simulate n moves is O(n³).
C. A pushdown automaton behaves like a Turing machine when it has one auxiliary memory.
D. L = {aⁿbⁿcⁿ : n ≥ 1} is not context-free but is context-sensitive.
Choose the correct answer from the options given below:
  1. A, B and C only
  2. A, B only
  3. D only
  4. B, C only
Answer & explanation →
Q60. Which phase of the compiler checks the grammar of the program?
  1. Code optimization
  2. Semantic analysis
  3. Code generation
  4. Syntax analysis
Answer & explanation →
Q66. Consider the following statements:
A. The set of Turing machine codes for TMs that accept all inputs that are palindromes (possibly along with other inputs) is decidable.
B. The language of codes for TMs M that, when started with blank tape, eventually write a 1 somewhere on the tape is undecidable.
C. The language accepted by a TM M, L(M), is always recursive.
D. Post's correspondence problem is undecidable.
Choose the correct answer from the options given below:
  1. A, B and C only
  2. B, C and D only
  3. A and C only
  4. B and D only
Answer & explanation →
Q68. Which of the following parsers is the most powerful?
  1. Operator precedence
  2. SLR
  3. Canonical LR
  4. LALR
Answer & explanation →
Q73. Which of the following statements is correct?
  1. Ackermann's function is primitive recursive.
  2. L = {aⁿbᵏcⁿ⁺ᵏ : n ≥ 0, k ≥ 0} is a regular language.
  3. L = {aⁿbʲ : n = j²} is not a context-free language.
  4. For every context-sensitive language L not including λ, there exists some linear bounded automaton M such that L ≠ L(M).
Answer & explanation →
Q90. A compiler for a high-level language that runs on one machine and produces code for another machine is called a
  1. Cross compiler
  2. Multipass compiler
  3. Optimizing compiler
  4. More than one of the above
Answer & explanation →

Answer key

  1. 25 – B
  2. 34 – C
  3. 40 – A
  4. 48 – C
  5. 60 – D
  6. 66 – D
  7. 68 – C
  8. 73 – C
  9. 90 – A