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 2024 (Cancelled Exam))

11 questions · answer key at the end · updated 11 Oct 2026
Q2. Shift-reduce conflicts are resolved by:
  1. Left recursion
  2. Left factoring
  3. Ambiguity
  4. Associativity and precedence
Answer & explanation →
Q5. Match List I with List II
List IList II
A. A → aB | a (a ∈ T; A, B ∈ V)I. Recursive Descent Parser
B. A → BC | a (a ∈ T; A, B, C ∈ V)II. Turing Machine
C. LL(1) grammarIII. Chomsky Normal Form
D. Halting problemIV. Finite Automata
  1. A-IV, B-III, C-I, D-II
  2. A-III, B-I, C-II, D-IV
  3. A-II, B-IV, C-III, D-I
  4. A-IV, B-III, C-II, D-I
Answer & explanation →
Q18. Which of the following is a function of the semantic analysis phase of compilation?
  1. Type conversion
  2. Tokenization
  3. Loop optimization
  4. Data flow analysis
Answer & explanation →
Q19. For regular languages and context-free languages, which is NOT correct?
A. Both are closed under union
B. Both are closed under concatenation
C. Both are closed under intersection
D. Both are closed under complementation
E. Both are closed under Kleene star
Choose the most appropriate answer from the options given below:
  1. A and B Only
  2. B and C Only
  3. C and D Only
  4. D and E Only
Answer & explanation →
Q20. Match List I with List II
List IList II
A. Back TrackingI. Automata
B. Infinite languages with matching numbersII. Undecidable Problem
C. Canonical LR ParserIII. Predictive Parser
D. Post Correspondence ProblemIV. Large number of states
  1. A-I, B-II, C-III, D-IV
  2. A-II, B-III, C-I, D-III
  3. A-IV, B-III, C-II, D-I
  4. A-III, B-I, C-IV, D-II
Answer & explanation →
Q32. An ambiguous grammar is one which has:
A. More than one derivation
B. More than one leftmost derivation
C. More than one rightmost derivation
D. More than one parse tree
E. More than one syntax tree
Choose the correct answer from the options given below:
  1. A and D Only
  2. B and C Only
  3. D and E Only
  4. A and E Only
Answer & explanation →
Q50. Arrange in appropriate order the construction of a finite automaton:
A. Minimum-state DFA
B. Regular expression
C. NFA-ε
D. Problem statement
E. DFA
Choose the correct answer from the options given below:
  1. B, C, E, A, D
  2. D, B, C, E, A
  3. C, E, B, A, D
  4. A, D, C, B, E
Answer & explanation →
Q52. The grammar
stmt → if expr then stmt else stmt | if expr then stmt
suffers from:
  1. Ambiguity
  2. Left factoring
  3. Left recursion
  4. λ-moves
Answer & explanation →
Q69. The language of the following PDA would be:
δ(q0, a, z0) = (q0, aaaz0)
δ(q0, a, a) = (q0, aaaa)
δ(q0, b, a) = (q1, λ)
δ(q1, b, a) = (q1, λ)
δ(q1, ε, z0) = (qf, z0), where qf is the final state.
  1. {aⁿbⁿ | n > 0}
  2. {aⁿb²ⁿ | n > 0}
  3. {aⁿb³ⁿ | n > 0}
  4. {aⁿb⁴ⁿ | n > 0}
Answer & explanation →
Q73. For the given two machines over {a, b}, which of the following is correct?
Machine 1: states A (start), B (final); A –a→ A, A –a→ B, B –b→ B, B –b→ A.
Machine 2: states A (start), B (final), C (final); A –a→ B, B –a→ B, B –b→ C, C –b→ C, C –a→ B.
  1. Both machines are DFAs
  2. Both are non-equivalent machines
  3. Both are equivalent machines
  4. Cannot be determined
Answer & explanation →
Q74. The number of tokens in the line ' for i in range (begin; end ; step) : ' is:
  1. 4
  2. 7
  3. 8
  4. 12
Answer & explanation →

Answer key

  1. 2 – D
  2. 5 – A
  3. 18 – A
  4. 19 – C
  5. 20 – D
  6. 32 – C
  7. 50 – B
  8. 52 – A
  9. 69 – C
  10. 73 – C
  11. 74 – D