Preparing your form...
|Theory of Computation and Compilers PYQs

UGC NET Computer Science Theory of Computation and Compilers Previous Year Questions (PYQs)

Practise 167 Theory of Computation and Compilers questions asked in UGC NET Computer Science from 2018–2026. Questions cover Finite automata, Regular expressions, Context-free grammars, Turing machines, Chomsky hierarchy of languages and Compiler phases and lexical analysis. Every question is shown with its options and the correct answer, free to read.

167 PYQs2018–2026Answers includedFree

Practise Theory of Computation and Compilers as timed sets

Focused 10-question sets with instant scoring, explanations, and weak-area analysis.

Start practice

All 167 Theory of Computation and Compilers PYQs

Ordered newest exam first. Each question links back to the full paper it came from.

  1. Given Pred(x) = x − 1 and T(x, y + 1) = Pred(T(x, y)), with T(x, 0) = x, which operation is a candidate for T?

    1. ASubtraction operation
    2. BAddition operation
    3. CMultiplication operation
    4. DDivision operation

    Answer: (A) Subtraction operation

    Explanation

    Sign in to read the full explanation
  2. Arrange these language families from specialization to generalization.

    A. All regular languages
    B. All Turing-acceptable languages
    C. All Turing-decidable languages
    D. All context-free languages

    1. AA, B, C, D
    2. BA, C, B, D
    3. CA, D, C, B
    4. DA, D, B, C

    Answer: (C) A, D, C, B

    Explanation

    Sign in to read the full explanation
  3. Which of the following statements is incorrect?

    1. AFor a context-free grammar G and string x, membership x ∈ L(G) can be decided in polynomial time.
    2. BIf L is context-free, then its complement is also context-free.
    3. CThe language {aⁿbᵐcᵖ : m, n, p ≥ 0, m ≠ n or m ≠ p} is not deterministic context-free.
    4. DThe class of deterministic context-free languages is closed under intersection.

    Answer: (B) If L is context-free, then its complement is also context-free.

    Explanation

    Sign in to read the full explanation
  4. Match List-I with List-II.

    List-I: LanguageList-II: Type
    A. L₁ = {aⁿbᵐ | n, m ≥ 0}
    B. L₂ = {aⁿbᵐ | n = m ≥ 0}
    C. L₃ = {aⁿbⁿcⁿdⁿeⁿ | n ≥ 1}
    D. L₄ = {aⁿbᵐcᵐdⁿe² | n, m ≥ 0}
    I. Unrestricted
    II. Context sensitive
    III. Regular
    IV. Context free
    1. AA-III, B-I, C-II, D-IV
    2. BA-III, B-IV, C-I, D-II
    3. CA-III, B-II, C-IV, D-I
    4. DA-II, B-III, C-IV, D-I

    Answer: (B) A-III, B-IV, C-I, D-II

    Explanation

    Sign in to read the full explanation
  5. Which is not part of the general activation record of a procedure?

    1. ALocal data
    2. BGlobal data
    3. CAccess link
    4. DTemporaries

    Answer: (B) Global data

    Explanation

    Sign in to read the full explanation
  6. Which option is the minimized DFA equivalent to the DFA shown?

    Original DFA and the four proposed minimized automata.

    Original DFA and the four proposed minimized automata.

    1. AOption 1
    2. BOption 2
    3. COption 3
    4. DOption 4

    Answer: (A) Option 1

    Explanation

    Sign in to read the full explanation
  7. If L₁ is a regular language and L₂ is a context-free language, which statement is correct?

    1. AAny subset of L₁ ∪ L₂ is context-free
    2. BL₁ ∩ L₂ is context-free
    3. CL₁ / L₂ is regular
    4. DL₁ ∩ L₂ is accepted by a deterministic pushdown automaton

    Answer: (B) L₁ ∩ L₂ is context-free

    Explanation

    Sign in to read the full explanation
  8. Which statement may be false for a decision problem X ∈ NP?

    1. AX can be solved in nondeterministic polynomial time
    2. BX can be solved in exponential time
    3. CX can be solved in polynomial space
    4. DX can be solved in deterministic polynomial time

    Answer: (D) X can be solved in deterministic polynomial time

    Explanation

    Sign in to read the full explanation
  9. For the grammar S → AB; B → +AB | ε; A → CD; D → *CD | ε; C → [S] | x, find FOLLOW(A) and FOLLOW(C).

    1. AFOLLOW(A) = {], $}; FOLLOW(C) = {+, ], $}
    2. BFOLLOW(A) = {+, ], $}; FOLLOW(C) = {*, +, ], $}
    3. CFOLLOW(A) = {, $, [}; FOLLOW(C) = {, [, $}
    4. DFOLLOW(A) = {*, ], $}; FOLLOW(C) = {+, ], $}

    Answer: (B) FOLLOW(A) = {+, ], $}; FOLLOW(C) = {*, +, ], $}

    Explanation

    Sign in to read the full explanation
  10. For the grammar S → AB; B → +AB | ε; A → CD; D → *CD | ε; C → [S] | x, identify the correct statement.

    1. AThe grammar is left recursive
    2. BThe grammar needs left factorization
    3. C[[x*x]+x] is a valid sentence of the grammar
    4. DThe grammar has an SLR(0) parser

    Answer: (C) [[x*x]+x] is a valid sentence of the grammar

    Explanation

    Sign in to read the full explanation
  11. For the grammar S → AB; B → +AB | ε; A → CD; D → *CD | ε; C → [S] | x, how many non-blank LL(1) table entries occur in the B and D rows?

    1. AB = 3; D = 4
    2. BB = 6; D = 5
    3. CB = 2; D = 3
    4. DB = 1; D = 2

    Answer: (A) B = 3; D = 4

    Explanation

    Sign in to read the full explanation
  12. For the grammar S → AB; B → +AB | ε; A → CD; D → *CD | ε; C → [S] | x, find FIRST(S) and FIRST(D).

    1. AFIRST(S) = {+, [, x}; FIRST(D) = {+, *}
    2. BFIRST(S) = {[, ], x}; FIRST(D) = {+, ε}
    3. CFIRST(S) = {[, x}; FIRST(D) = {*, ε}
    4. DFIRST(S) = {[, x, ε}; FIRST(D) = {*, ε}

    Answer: (C) FIRST(S) = {[, x}; FIRST(D) = {*, ε}

    Explanation

    Sign in to read the full explanation
  13. For the augmented grammar S′ → S; S → AB; B → +AB | ε; A → CD; D → *CD | ε; C → [S] | x, how many productions are in the I₁ state of the canonical LR(0) set?

    1. A1
    2. B2
    3. C4
    4. D6

    Answer: (A) 1

    Explanation

    Sign in to read the full explanation
  14. Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R

    Assertion (A): If L is regular, then its compliment L' is necessarily regular.
    Reason (R): Complement of a language can be obtained by swapping final and non-final states in a DFA.

    1. ABoth A and R are correct and R is the correct explanation of A
    2. BBoth A and R are correct but R is NOT the correct explanation of A
    3. CA is correct but R is not correct
    4. DA is not correct but R is correct

    Answer: (A) Both A and R are correct and R is the correct explanation of A

    Explanation

    Sign in to read the full explanation
  15. A phase of a compiler which produces the symbol table is

    1. ASyntax analysis
    2. BSemantic analysis
    3. CTarget code generation
    4. DCode optimization

    Answer: (A) Syntax analysis

    Explanation

    Sign in to read the full explanation
  16. Which of the following languages cannot be accepted by a pushdown automaton?

    A. L = { aⁿbⁿcⁿ : n ≥ 0 }
    B. L = { aᵖ : p is Prime }
    C. L = { wcwᴿ : w ∈ (a, b)* }
    D. L = { w ∈ (a, b)* : nₐ(w) = n_b(w) }
    E. L = { aⁿbᵐc⁽ⁿ⁺ᵐ⁾ : n ≥ 0, m ≥ 0 }

    1. AA, C & D Only
    2. BB, D & E Only
    3. CA & B Only
    4. DC & D Only

    Answer: (C) A & B Only

    Explanation

    Sign in to read the full explanation
  17. Match List-I (Grammar types) with List-II (Production forms).

    List-I (Grammar)List-II (All productions are of the form)
    A. Regular GrammarI. A → aX, where a ∈ T and X ∈ V*
    B. Unrestricted GrammarII. A → xB, A → x or A → Bx, A → x where A, B ∈ V and x ∈ T*
    C. Chomsky Normal FormIII. x → y, where x ∈ (V ∪ T)+ and y ∈ (V ∪ T)*
    D. Greibach Normal FormIV. A → BC or A → a, where A, B, C are in V and a is in T
    1. AA-II, B-III, C-I, D-IV
    2. BA-I, B-III, C-II, D-IV
    3. CA-II, B-III, C-IV, D-I
    4. DA-II, B-IV, C-I, D-III

    Answer: (C) A-II, B-III, C-IV, D-I

    Explanation

    Sign in to read the full explanation
  18. Arrange the following tasks of a lexical analyzer in the correct sequence.

    A. Token Generation.
    B. Removal of comments/White sphere.
    C. Buffering and reading source characters.
    D. Return token stream to parser.

    1. AA, B, C, D
    2. BB, A, C, D
    3. CC, B, A, D
    4. DB, A, D, C

    Answer: (C) C, B, A, D

    Explanation

    Sign in to read the full explanation
  19. Match List-I (Compiler input) with List-II (Compiler phase).

    LIST-I (Input)LIST-II (Compiler Phase)
    A. Syntax TreeI. Code Generator
    B. Character StreamII. Syntax Analyzer
    C. Intermediate RepresentationIII. Semantic Analyzer
    D. Token StreamIV. Lexical Analyzer
    1. AA-II, B-III, C-IV, D-I
    2. BA-III, B-IV, C-I, D-II
    3. CA-III, B-I, C-IV, D-II
    4. DA-I, B-IV, C-II, D-III

    Answer: (B) A-III, B-IV, C-I, D-II

    Explanation

    Sign in to read the full explanation
  20. If r₁ and r₂ are regular expressions, then which of the following are correct?
    A. L(r₁ + r₂) = L(r₁) ∪ L(r₂)
    B. L(r₁ · r₂) = L(r₁)L(r₂)
    C. L((r₁)) = L(r₁)
    D. L(r₁*) = (L(r₁))*

    1. AA & B Only
    2. BB, C & D Only
    3. CA, C & D Only
    4. DA, B, C & D

    Answer: (D) A, B, C & D

    Explanation

    Sign in to read the full explanation
  21. Let P and Q be two regular expressions over Σ. If P does not contain ε, then the equation in R namely, R = Q + RP has a unique solution given by:

    1. AR = Q* P*
    2. BR = Q P*
    3. CR = P Q*
    4. DR = Q* + P*R

    Answer: (B) R = Q P*

    Explanation

    Sign in to read the full explanation
  22. What is the space complexity of the CYK algorithm for the P table, where n is the number of words in the sentence and m is the number of non-terminal symbols in the grammar?

    1. AO(n³)
    2. BO(nm²)
    3. CO(n²m)
    4. DO(n²m²)

    Answer: (C) O(n²m)

    Explanation

    Sign in to read the full explanation
  23. Assertion (A): L = {aⁿbⁿcⁿ : n ≥ 0} is accepted by a linear bounded automaton.
    Reason (R): Linear bounded automata recognize exactly the class of context-sensitive languages.

    1. ABoth A and R are correct and R is the correct explanation of A
    2. BBoth A and R are correct but R is NOT the correct explanation of A
    3. CA is correct but R is not correct
    4. DA is not correct but R is correct

    Answer: (A) Both A and R are correct and R is the correct explanation of A

    Explanation

    Sign in to read the full explanation
  24. Arrange the following steps in the order of execution while proving that a language is non-regular using the Pumping Lemma.

    A. Split the string into xyz satisfying the pumping lemma conditions
    B. Assume the language is regular
    C. Choose a string of length greater than or equal to the pumping length
    D. Show a contradiction when pumping y

    1. AB, C, D, A
    2. BC, D, A, B
    3. CB, C, A, D
    4. DA, B, C, D

    Answer: (C) B, C, A, D

    Explanation

    Sign in to read the full explanation
  25. Which is the best description of the language accepted by the DFA?

    DFA over the alphabet {a, b, c}.

    DFA over the alphabet {a, b, c}.

    1. AL = (a* + b* + c*)+
    2. BL = (a + b + c)(abc)+(a + b + c)
    3. CThe set of strings that start with a, b, or c and end with c
    4. DThe set of strings having an even count, including zero, of the substring abc

    Answer: (D) The set of strings having an even count, including zero, of the substring abc

    Explanation

    Sign in to read the full explanation
  26. Practise Theory of Computation and Compilers in a timed set
  27. Which pictured NFA is valid for the given DFA?

    Given DFA and four candidate NFA diagrams.

    Given DFA and four candidate NFA diagrams.

    1. ADiagram 1
    2. BDiagram 2
    3. CDiagram 3
    4. DDiagram 4

    Answer: (D) Diagram 4

    Explanation

    Sign in to read the full explanation
  28. Arrange LL(0), LR(0), SLR, LALR(1), and LR(1) parsers from least to greatest grammar-handling power.

    1. ALL(0) → LR(0) → SLR → LR(1) → LALR(1)
    2. BSLR → LR(0) → LL(0) → LR(1) → LALR(1)
    3. CLL(0) → LR(0) → SLR → LALR(1) → LR(1)
    4. DLR(0) → LL(0) → SLR → LR(1) → LALR(1)

    Answer: (C) LL(0) → LR(0) → SLR → LALR(1) → LR(1)

    Explanation

    Sign in to read the full explanation
  29. Editorially repaired version of an ambiguous NTA item. Which grammars are context-free but not regular?

    GrammarProductions
    AS → Ab; aS → aA; A → a
    BS → Ab; A → Sa; A → a
    CS → AS; S → aA; A → a
    DS → Ab; S → aA; A → a
    ES → Sb; A → Aa; A → ε
    1. AA and B only
    2. BC and D only
    3. CC only
    4. DA, B, D, and E only

    Answer: (C) C only

    Explanation

    Sign in to read the full explanation
  30. Match Types 3, 2, 1, and 0 grammars to their production restrictions.

    List IList II
    A. Type 3 GrammarI. V → (V ∪ Σ)*
    B. Type 2 GrammarII. λVβ → λ(V ∪ Σ)*β, where (λ, β) ∈ (V ∪ Σ)*
    C. Type 1 GrammarIII. (V ∪ Σ)* → (V ∪ Σ)*
    D. Type 0 GrammarIV. V → VΣ | Σ
    1. AA-II, B-III, C-IV, D-I
    2. BA-III, B-I, C-IV, D-II
    3. CA-IV, B-I, C-II, D-III
    4. DA-III, B-II, C-I, D-IV

    Answer: (C) A-IV, B-I, C-II, D-III

    Explanation

    Sign in to read the full explanation
  31. Which high-level program corresponds to the displayed three-address code?

    Three-address code and its four high-level-code alternatives.

    Three-address code and its four high-level-code alternatives.

    1. ASource code option 1
    2. BSource code option 2
    3. CSource code option 3
    4. Dinit = x/(y+2); limit = 10; while (i > j && num > b) { num = limit-1; b = y+2; i = i-num; } j = i-num; k = j+b;

    Answer: (D) init = x/(y+2); limit = 10; while (i > j && num > b) { num = limit-1; b = y+2; i = i-num; } j = i-num; k = j+b;

    Explanation

    Sign in to read the full explanation
  32. What are the leaders for this three-address code?

    100: t1 = y + 2
    101: initial = x / t1
    102: limit = 10
    103: if i > j goto 105
    104: goto 111
    105: if num > b goto 107
    106: goto 111
    107: num = limit - 1
    108: b = y + 2
    109: i = i - num
    110: goto 103
    111: j = i - num
    112: k = j + b
    
    1. A100, 102, 103, 104, 105, 107, 110
    2. B100, 103, 105, 107, 111, 112
    3. C100, 103, 105, 106, 107, 111
    4. D100, 103, 104, 105, 106, 107, 111

    Answer: (D) 100, 103, 104, 105, 106, 107, 111

    Explanation

    Sign in to read the full explanation
  33. Which displayed flow graph is correct for the given three-address code?

    Four adjacency-matrix flow-graph alternatives for the three-address code.

    Four adjacency-matrix flow-graph alternatives for the three-address code.

    1. AAdjacency-matrix option 1
    2. BAdjacency-matrix option 2
    3. CAdjacency-matrix option 3
    4. DAdjacency-matrix option 4

    Answer: (A) Adjacency-matrix option 1

    Explanation

    Sign in to read the full explanation
  34. In the flow graph for the given three-address code, which blocks are dominated by Block 3 and Block 5?

    1. ABlock 3: 3; Block 5: 5
    2. BBlock 3: 3, 4, 5, 6; Block 5: 5, 6
    3. CBlock 3: 3, 7; Block 5: 5, 7
    4. DBlock 3: 3, 4, 7; Block 5: 5, 6, 7

    Answer: (A) Block 3: 3; Block 5: 5

    Explanation

    Sign in to read the full explanation
  35. Editorially repaired version of an NTA-dropped item. Consider this three-address code. Assume y is not reassigned between lines 100 and 108. Which single change is a semantics-preserving common-subexpression elimination?

    100: t1 = y + 2
    101: initial = x / t1
    102: limit = 10
    103: if i > j goto 105
    104: goto 111
    105: if num > b goto 107
    106: goto 111
    107: num = limit - 1
    108: b = y + 2
    109: i = i - num
    110: goto 103
    111: j = i - num
    112: k = j + b
    
    1. AReplace only line 108 with b = t1.
    2. BMove num = limit - 1 before the test at line 105.
    3. CReplace lines 111–112 with k = i + b.
    4. DReplace line 109 with i = i - limit - 1.

    Answer: (A) Replace only line 108 with b = t1.

    Explanation

    Sign in to read the full explanation
  36. The kinds of symbols for basic syntactic elements of first-order logic are:

    A. Constant
    B. Domain
    C. Predicate
    D. Temporal
    E. Function

    1. AB and D only
    2. BA, B and C only
    3. CA, C and E only
    4. DC and D only

    Answer: (C) A, C and E only

    Explanation

    Sign in to read the full explanation
  37. Which statement is true about the pumping lemma for regular languages?

    1. AIt applies to all regular languages
    2. BIt applies only to infinite regular languages
    3. CIt applies to all context-free languages
    4. DIt applies to all recursively enumerable languages

    Answer: (A) It applies to all regular languages

    Explanation

    Sign in to read the full explanation
  38. Regarding code optimisation, choose the correct sequence.

    A. Algebraic simplification
    B. Use of machine idioms
    C. Redundant-instruction elimination
    D. Flow-of-control optimisation
    E. Improved target code

    1. AA, C, B, D, E
    2. BB, C, D, A, E
    3. CC, D, A, B, E
    4. DD, B, A, C, E

    Answer: (C) C, D, A, B, E

    Explanation

    Sign in to read the full explanation
  39. Match List-I with List-II.

    List-IList-II
    A. Conflict resolution
    B. Common subexpression
    C. Quadruples
    D. L-attributed definitions
    I. Three-address code
    II. Precedence
    III. Syntax-directed translations
    IV. Directed acyclic graph
    1. AA-III, B-II, C-IV, D-I
    2. BA-II, B-IV, C-I, D-III
    3. CA-II, B-III, C-I, D-IV
    4. DA-IV, B-I, C-II, D-III

    Answer: (B) A-II, B-IV, C-I, D-III

    Explanation

    Sign in to read the full explanation
  40. Which of the following CFG(s) is/are in Chomsky Normal Form? All capital letters are variables and lower-case letters are terminals.

    GrammarProductions
    AS → ABC | AB; A → a; B → b; C → d
    BX → RT | TR; T → l; R → XT | r
    CP → qP | sQ; M → MN | MP
    DN → nmin; P → P
    1. AA and B only
    2. BB only
    3. CC only
    4. DB and D only

    Answer: (B) B only

    Explanation

    Sign in to read the full explanation
  41. Choose the correct statements.

    A. A problem which is NP-complete can be solved in polynomial time.
    B. All NP-complete problems are NP-hard problems.
    C. If an NP-hard problem can be solved in polynomial time, then all NP-complete problems can be solved in polynomial time.
    D. All NP-hard problems are not NP-complete.

    1. AA and C only
    2. BB and D only
    3. CA, B and C only
    4. DA, B, C and D

    Answer: (D) A, B, C and D

    Explanation

    Sign in to read the full explanation
  42. Which language is represented by the displayed Turing-machine transition function?

    1. A{aⁿbⁿ | n ≥ 0}
    2. B{abⁿ | n ≥ 1}
    3. C{ab* | n > 0}
    4. D{aⁿb* | n > 1}

    Answer: (B) {abⁿ | n ≥ 1}

    Explanation

    Sign in to read the full explanation
  43. Match List-I with List-II.

    List-IList-II
    A. Type-0 grammar
    B. Type-1 grammar
    C. Type-2 grammar
    D. Type-3 grammar
    I. Linear grammar
    II. GNF
    III. x → y, |x| ≤ |y|; x,y ∈ (V ∪ T)*
    IV. Recursively enumerable
    1. AA-I, B-II, C-III, D-IV
    2. BA-II, B-I, C-III, D-IV
    3. CA-III, B-II, C-IV, D-I
    4. DA-IV, B-III, C-I, D-II

    Answer: (D) A-IV, B-III, C-I, D-II

    Explanation

    Sign in to read the full explanation
  44. Yacc is which of the following parsers?

    1. APredictive parser
    2. BSLR parser
    3. CCLR parser
    4. DLALR parser

    Answer: (D) LALR parser

    Explanation

    Sign in to read the full explanation
  45. For the automaton described in the accompanying comprehension passage, which displayed diagram represents the minimum-state DFA?

    DFA options 1-4 for Question 141

    DFA options 1-4 for Question 141

    1. ADFA diagram 1
    2. BDFA diagram 2
    3. CDFA diagram 3
    4. DDFA diagram 4

    Answer: (D) DFA diagram 4

    Explanation

    Sign in to read the full explanation
  46. For the automaton in the preceding comprehension passage, which displayed diagram is correct?

    DFA options 1-4 for Question 142

    DFA options 1-4 for Question 142

    1. ADFA diagram 1
    2. BDFA diagram 2
    3. CDFA diagram 3
    4. DDFA diagram 4

    Answer: (C) DFA diagram 3

    Explanation

    Sign in to read the full explanation
  47. For the preceding automaton passage, which displayed DFA represents the language accepted by the machine?

    DFA options 1-4 for Question 143

    DFA options 1-4 for Question 143

    1. ADFA diagram 1
    2. BDFA diagram 2
    3. CDFA diagram 3
    4. DDFA diagram 4

    Answer: (C) DFA diagram 3

    Explanation

    Sign in to read the full explanation
  48. For the automaton described in the comprehension passage, which regular expression represents its accepted language?

    1. A(a+b)*aab
    2. Baba(a+b)*
    3. Cb(a+b)*b(a+b)a(a+b)
    4. D(a+b)abb(a+b)

    Answer: (D) (a+b)abb(a+b)

    Explanation

    Sign in to read the full explanation
  49. For the automaton described in the comprehension passage, which grammar represents the language accepted by the machine?

    1. AS → AabbB, A → aA | ε, B → bB | ε
    2. BS → abbA, A → aA | ε | bA
    3. CS → AabbA, A → aA | bA | ε
    4. DS → Aabb, A → aA | bA | ε

    Answer: (C) S → AabbA, A → aA | bA | ε

    Explanation

    Sign in to read the full explanation
  50. Consider the grammar:

    S → A
    A → $B$ | id
    B → B, A | A

    If I₀ = CLOSURE({[S → .A]}), how many items are in GOTO(I₀, $)?

    1. A3
    2. B4
    3. C5
    4. D6

    Answer: (C) 5

    Explanation

    Sign in to read the full explanation
  51. Consider the Grammar:
    T → Qx
    Q → RS
    R → y ∣ ϵ
    S → z ∣ ϵ
    Here x, y, z are terminals and T, Q, R, S are non-
    terminals.
    What will be the follow set of the non-terminal R?

    1. A{x,y}
    2. B{y,z}
    3. C{z,x}
    4. D{ϵ}

    Answer: (C) {z,x}

    Explanation

    Sign in to read the full explanation
  52. Practise Theory of Computation and Compilers in a timed set
  53. Which of the following properties correctly
    describe a Regular Grammar ?
    A. All production rules are of the form A→xB or
    A→x, where A and B are non terminal symbols
    and x is a terminal symbol.
    B. Regular grammars are more powerful than
    context-free grammars and can express any type
    of language.
    C. There is a direct correspondence between
    regular grammar and finite automata.
    D. Regular grammars can generate languages
    that are not recognised by any type of automata.

    1. A(A) and (B) Only
    2. B(B) and (C) Only
    3. C(C) and (D) Only
    4. D(A) and (C) Only

    Answer: (D) (A) and (C) Only

    Explanation

    Sign in to read the full explanation
  54. If L₁ and L₂ are context free languages, which one of the following is true about L₁ ∩ L₂?

    1. AL1 L2 is context free.
    2. BL1 L2 is Regular
    3. CL1 L2 is Recursive Enumerable
    4. DL1 L2 is Context Sensitive

    Answer: (C) L1 L2 is Recursive Enumerable

    Explanation

    Sign in to read the full explanation
  55. Which of the following tasks could be attained
    using syntax trees in compiler design ?
    A. Type Checking
    B. Code Generation
    C. Code Optimization
    D. Error Handling

    1. A(A), (B), (C) Only
    2. B(B), (C), (D) Only
    3. C(A), (C), (D) Only
    4. D(A), (B), (D) Only

    Answer: (A) (A), (B), (C) Only

    Explanation

    Sign in to read the full explanation
  56. Match List-I with List-II.

    List-IList-II
    (A) HTML(I) Allow for dynamic and interactive web pages.
    (B) DHTML(II) Defines the structure of web pages.
    (C) XML(III) Object-oriented programming language for web applications.
    (D) JAVA(IV) Used for data storage and transport.
    1. A(A)-(I), (B)-(III), (C)-(II), (D)-(IV)
    2. B(A)-(II), (B)-(III), (C)-(IV), (D)-(I)
    3. C(A)-(II), (B)-(I), (C)-(IV), (D)-(III)
    4. D(A)-(III), (B)-(I), (C)-(IV), (D)-(II)

    Answer: (C) (A)-(II), (B)-(I), (C)-(IV), (D)-(III)

    Explanation

    Sign in to read the full explanation
  57. Arrange the following stages of a Turing Machine
    (TM) operation in the correct order as they occur
    during computation.
    A. Writing a symbol on the tape
    B. Moving the tape head left to right
    C. Reading a symbol from the tape
    D. Transitioning to a new state based on the
    current state and symbol read
    E. Halting and accepting or rejecting the input

    1. A(C), (A), (B), (D), (E)
    2. B(C), (B), (A), (D), (E)
    3. C(C), (D), (A), (B), (E)
    4. D(C), (D), (B), (A), (E)

    Answer: (C) (C), (D), (A), (B), (E)

    Explanation

    Sign in to read the full explanation
  58. Which of the following languages can be recognized by a Non-Deterministic Finite Automaton (NFA) but cannot be recognized by a Deterministic Finite Automaton (DFA)?

    A. L₁ = {w ∈ {0,1}* | the length of w is even}
    B. L₂ = {w ∈ {0,1}* | the length of w is odd}
    C. L₃ = {w ∈ {0,1}* | all 0s precede all 1s in w}
    D. L₄ = {w ∈ {0,1}* | w contains an equal number of 0s and 1s}
    E. L₅ = {w ∈ {0,1}* | all 1s precede all 0s in w}

    1. A(A) and (B) only
    2. B(B) and (C) only
    3. C(C) and (D) only
    4. DNone of the above

    Answer: (D) None of the above

    Explanation

    Sign in to read the full explanation
  59. Arrange the following stages of parsing in the
    correct order as they typically occur in the
    compilation process.
    A. Lexical Analysis
    B. Sematic Analysis
    C. Syntax Analysis
    D. Intermediate Code Generation
    E. Code Optimization

    1. A(A), (B), (C), (D), (E)
    2. B(A), (C), (B), (D), (E)
    3. C(A), (D), (B), (C), (E)
    4. D(A), (C), (D), (B), (E)

    Answer: (B) (A), (C), (B), (D), (E)

    Explanation

    Sign in to read the full explanation
  60. Arrange the following Language Classes in
    ascending order according to their expressive
    power, as defined by Chomsky hierarchy:
    A. Context-free languages
    B. Context-sensitive languages
    C. Regular languages
    D. Unrestricted Grammars

    1. A(C), (A), (B), (D)
    2. B(C), (A), (D), (B)
    3. C(A), (C), (B), (D)
    4. D(A), (D), (B), (C)

    Answer: (A) (C), (A), (B), (D)

    Explanation

    Sign in to read the full explanation
  61. Which of the following languages are context-free?

    A. {wⁱxʲyᵏzˡ | i + k = j + l; i, j, k, l ≥ 0}
    B. {wⁱxʲyᵏzˡ | i = j and k = l; i, j, k, l ≥ 0}
    C. {wⁱxʲyᵏzˡ | i = j = k and k ≠ l; i, j, k, l ≥ 0}
    D. {wⁱxʲyᵏzˡ | i = j = k + l; i, j, k, l ≥ 0}
    E. {wⁱxʲyᵏzˡ | i = j = l and k ≠ l; i, j, k, l ≥ 0}

    1. A(A) and (B) only
    2. B(B) and (C) only
    3. C(C) and (D) only
    4. D(D) and (E) only

    Answer: (A) (A) and (B) only

    Explanation

    Sign in to read the full explanation
  62. Let L={ab, aa, baa}. Which of the following strings are not in L*.

    1. Aabaabaaabaa
    2. Baaaabaaaa
    3. Cbaaaaabaaaab
    4. Dbaaaaabaa

    Answer: (C) baaaaabaaaab

    Explanation

    Sign in to read the full explanation
  63. Let A={a, b} and L=A*. Let x={a"b", n>0}. The languages L U X and X are respectively :

    1. ANot regular, Regular
    2. BRegular, Regular
    3. CRegular, Not regular
    4. DNot Regular, Not Regular

    Answer: (C) Regular, Not regular

    Explanation

    Sign in to read the full explanation
  64. Which of the following symbol table implementation is best suited if access time is to be minimum ?

    1. A_ Linear list
    2. BSearch tree
    3. CHash Table
    4. DSelf organisation list

    Answer: (C) Hash Table

    Explanation

    Sign in to read the full explanation
  65. Consider a Grammar E>E+n|ExXn|n for a sentence n+n Xn, the handles in the right-sentential form of the reduction are ?

    1. An,E+nandE+nxn
    2. Bn,E+nand E+Exn
    3. Cn,n+nandn+nxn
    4. Dn,E+nand Exn

    Answer: (D) n,E+nand Exn

    Explanation

    Sign in to read the full explanation
  66. One of the purposes of using intermediate code in compilers is to :

    1. Amake parsing and semantic analysis simpler
    2. Bimprove error recovery and error reporting
    3. Cincrease the chances of reusing the machine independent code optimizer in other compilers
    4. Dimprove the register allocation

    Answer: (C) increase the chances of reusing the machine independent code optimizer in other compilers

    Explanation

    Sign in to read the full explanation
  67. The sum of minimum and maximum number of final states for a Deterministic Finite Automata (DFA) having 'P" state is equal to : () Pp

    1. Ap
    2. Bp-1
    3. Cp+1
    4. Dp+2

    Answer: (C) p+1

    Explanation

    Sign in to read the full explanation
  68. Three address codes can be represented in special structures known as :
    A. Quadruples
    B. Triples
    C. Patterns
    D. Indirect Triples Choose the correct answer from the options given below :

    1. A(A) and (B) Only
    2. B(A), (B) and (D) Only
    3. C(B) and (C) Only
    4. D(B), (Cand (D) Only

    Answer: (B) (A), (B) and (D) Only

    Explanation

    Sign in to read the full explanation
  69. Which of the statement is/are CORRECT ?
    A. Moore and Mealy machines are finite state machines with output capabilities.
    B. Any given Moore machine has an equivalent Mealy machine.
    C. Any given Mealy machine has an equivalent Moore machine.
    D. Moore machine is not a finite state machine. Choose the correct answer from the options given below :

    1. A(A) and (B) Only
    2. B(A), (B) and (©) Only
    3. C(B) and (D) Only
    4. D(A), (B) and (D) Only

    Answer: (B) (A), (B) and (©) Only

    Explanation

    Sign in to read the full explanation
  70. Arrange the following phases of a compiler as per their order of execution (start to end)
    A. Target code generation
    B. Syntax Analysis
    C. Code optimization
    D. Semantic Analysis
    E. Lexical Analysis Choose the correct answer from the options given below :

    1. A(B), (B), (D), (A), ©)
    2. B(&), (D), @), (A), (©
    3. C(&), (B), (D), (©), (A)
    4. D(B), (D), (E), (A), ©)

    Answer: (C) (&), (B), (D), (©), (A)

    Explanation

    Sign in to read the full explanation
  71. The prototyping model has the sequence :
    A. Customer Evaluation
    B. Quick design
    C. Requirements
    D. Implement
    E. Design Choose the correct answer from the options given below :

    1. AC → A → D → B → E
    2. BB → C → A → D → E
    3. CC → B → D → A → E
    4. DE → B → C → D → A

    Answer: (C) C → B → D → A → E

    Explanation

    Sign in to read the full explanation
  72. Which of the following parser is most powerful parser?

    1. AOperator precedence
    2. BSLR
    3. CCanonical LR
    4. DLALR

    Answer: (C) Canonical LR

    Explanation

    Sign in to read the full explanation
  73. Which of the following statement is correct?

    1. AAckermann's function is primitive recursive.
    2. BL = {aⁿ bᵏ cⁿ⁺ᵏ : n ≥ 0, k ≥ 0} is regular language.
    3. CL = {aⁿ bʲ : n = j²} is not context free language
    4. DFor every context sensitive language L not including λ, there exists some linear bounded automata M such that L ≠ L(M).

    Answer: (C) L = {aⁿ bʲ : n = j²} is not context free language

    Explanation

    Sign in to read the full explanation
  74. Consider the finite automaton F1 shown, which accepts a language L over its input alphabet. C is the start state and E (double circle) is the only accepting state. The transitions are: C to S, S to E, and C to E directly (three forward edges), together with S back to C and E back to S (two backward edges). Let F2 be the finite automaton obtained by reversal of F1 (reverse every transition and swap the roles of the start and accepting states). Then which of the following is correct?

    1. AL(F1) ≠ L(F2)
    2. BL(F1) = L(F2)
    3. CL(F1) ≤ L(F2)
    4. DL(F1) ≥ L(F2)

    Answer: (B) L(F1) = L(F2)

    Explanation

    Sign in to read the full explanation
  75. The maximum yield length of the following CNF CFG is

    S → AB
    A → CD
    B → e
    C → a
    D → b

    1. A8
    2. B7
    3. C4
    4. D5

    Answer: (D) 5

    Explanation

    Sign in to read the full explanation
  76. Consider following statements:

    A. A context free language is generated by LR(0) grammar if and only if it is accepted by a deterministic pushdown automata and has prefix property
    B. If M1 is the single tape TM simulating multitape TM M, then time taken by M1 to simulate n moves is O(n²)
    C. Push down automata behaves like a Turing machine when it has one auxiliary memory.
    D. L = {aⁿbⁿcⁿ : n ≥ 1} is not context free but context sensitive.

    1. AA, B and C only
    2. BA, B only
    3. CD only
    4. DB, C only

    Answer: (A) A, B and C only

    Explanation

    Sign in to read the full explanation
  77. A. The set of Turing machine codes for TM's that accept all inputs that are palindromes (possibly along with some other inputs) is decidable
    B. The language of codes for TM's 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 is L(M) is always recursive
    D. Post's correspondence problem is undecidable

    1. AA, B and C only
    2. BB, C and D only
    3. CA and C only
    4. DB and D only

    Answer: (D) B and D only

    Explanation

    Sign in to read the full explanation
  78. Practise Theory of Computation and Compilers in a timed set
  79. A. If some NP-complete problem P is in ℙ (P class) then P = NP
    B. TSP is in ℕℙ (NP)
    C. SAT is in ℕℙ (NP)
    D. Hamilton circuit problem is not NP-complete

    1. AA, B and C only
    2. BB, C and D only
    3. CC, D and A only
    4. DD, A and B only

    Answer: (A) A, B and C only

    Explanation

    Sign in to read the full explanation
  80. Which phase of a compiler checks the grammar of the programming language?

    1. ACode optimization
    2. BSemantic analysis
    3. CCode generators
    4. DSyntax analysis

    Answer: (D) Syntax analysis

    Explanation

    Sign in to read the full explanation
  81. Consider the following language over the alphabet {a, b, c}:

    L = {w ∈ {a, b, c}* : n_a(w) + n_b(w) = n_c(w)}

    Which of the following best describes L?

    1. AContext free but not linear
    2. BNot context free
    3. CContext free and linear
    4. DLinear

    Answer: (A) Context free but not linear

    Explanation

    Sign in to read the full explanation
  82. The compiler for a high level language that runs on one machine and produces code for a different target machine is called a

    1. ACross compiler
    2. BMultipass compiler
    3. COptimizing Compiler
    4. DOne pass Compiler

    Answer: (A) Cross compiler

    Explanation

    Sign in to read the full explanation
  83. Statement I: If f and g are two functions and f = O(g) but g is not o(f), we say that the growth rate of g is smaller than that of f
    Statement II: The class of all decision problems decided by a Turing Machine in exponential time, that is O(2^k) where k is a constant, is called EXP

    Which one of the following is correct in the light of the above statements?

    1. ABoth Statement I and Statement II are correct
    2. BBoth Statement I and Statement II are incorrect
    3. CStatement I is correct but Statement II is incorrect
    4. DStatement I is incorrect but Statement II is correct

    Answer: (D) Statement I is incorrect but Statement II is correct

    Explanation

    Sign in to read the full explanation
  84. The transition function 'δ' in multi-tape Turing machine is defined as:

    1. Aδ: 2^Q × Γᵏ → 2^Q × Γᵏ × {L, R, S}ᵏ
    2. Bδ: Q × Q × Γᵏ → Q × Q × Γᵏ × {L, R, S}ᵏ
    3. Cδ: Q × Γᵏ → Q × Γᵏ × {L, R, S}ᵏ
    4. Dδ: Q × Γᵏ × 2^Q → Q × Γᵏ × 2^Q × {L, R, S}ᵏ

    Answer: (C) δ: Q × Γᵏ → Q × Γᵏ × {L, R, S}ᵏ

    Explanation

    Sign in to read the full explanation
  85. In Pumping Lemma for regular languages, to say a language is satisfying pumping lemma, what is the minimum length of 'y' if you consider the string as 'xyz'?

    1. An
    2. B2
    3. C1
    4. D0

    Answer: (C) 1

    Explanation

    Sign in to read the full explanation
  86. The item generated by the production A → ε is:

    1. AA → •
    2. BA → ε•
    3. CA → •ε
    4. DA → ε

    Answer: (A) A → •

    Explanation

    Sign in to read the full explanation
  87. In the ε-NFA, M = ({q0, q1, q2, q3}, {a}, δ, q0, {q3}), where 'δ' is given by q0 moving to q1 on ε, q1 moving to q2 on ε, and q2 moving to both q2 and q3 on 'a', what is the minimum length of string to reach the final state?

    Stateεa
    q0{q1}{}
    q1{q2}{}
    q2{}{q2,q3}
    q3{}{}

    Transition table for the ε-NFA

    1. A0
    2. B1
    3. C2
    4. D3

    Answer: (B) 1

    Explanation

    Sign in to read the full explanation
  88. Circuit satisfiability problem: Given a Boolean combinational circuit composed of AND, OR and NOT gates, is it satisfiable? A one output Boolean combinatorial circuit is satisfiable means for the given inputs the output will be 1.

    A. The circuit satisfiability problem belongs to class NP
    B. The circuit satisfiability problem is at least as hard as any language in NP
    C. The circuit satisfiability is NP-Complete
    D. The size of the circuit is O(K²+1)
    E. If P≠NP, this situation would contradict the NP-Completeness of the problem.

    Choose the correct answer from the options given below:

    1. AA, C, D Only
    2. BB, D, E Only
    3. CA, B, C Only
    4. DB, C, D Only

    Answer: (C) A, B, C Only

    Explanation

    Sign in to read the full explanation
  89. Which of the following is (are) correct about the regular expression aabbccdd

    A. The language represented by the regular expression consists of strings of the form aⁱbʲcᵏdˡ, where i, j, k and l are each at least 1.
    B. The expression requires the number of a's to be equal to the number of b's.
    C. The expression requires the number of c's to be equal to the number of d's.

    Choose the correct answer from the options given below:

    1. AOnly A is correct
    2. BOnly B is correct
    3. CBoth A and B are correct
    4. DAll the three A, B and C are correct

    Answer: (A) Only A is correct

    Explanation

    Sign in to read the full explanation
  90. Which of the following statements are correct?

    A. The first three-address instruction in the intermediate code is a leader.
    B. The instruction which is exactly at the middle of the given three address code is a leader.
    C. Any instruction that is the target of a conditional or unconditional jump is a leader.
    D. Any instruction that immediately follows a conditional or unconditional jump is a leader.

    Choose the correct answer from the options given below:

    1. AA, B and C
    2. BB, C and D
    3. CA, C and D
    4. DA, B, C and D

    Answer: (C) A, C and D

    Explanation

    Sign in to read the full explanation
  91. Which of the following are correct on regular expressions?

    A. Φ + L = L + Φ = L
    B. εL = Lε = L
    C. ΦL = LΦ = Φ
    D. ΦL = LΦ = L

    Choose the correct answer from the options given below:

    1. AA, B and D only
    2. BA, B and C only
    3. CB and D only
    4. DA and D only

    Answer: (B) A, B and C only

    Explanation

    Sign in to read the full explanation
  92. Match List I with List II.

    List-IList-II
    A. S→aSa | aaI. ((2ⁿ*3)-4), n≥1
    B. S→aaSaa | aaII. 2ⁿ, n≥1
    C. S→aaaSaaa | aaIII. ((4*2ⁿ)-6), n≥1
    D. S→aaaaSaaaa | aaIV. 2ⁿ-2, n≥2

    List I and List II for the matching question

    1. AA-IV, B-III, C-I, D-II
    2. BA-II, B-IV, C-I, D-III
    3. CA-I, B-IV, C-III, D-II
    4. DA-II, B-III, C-I, D-IV

    Answer: (B) A-II, B-IV, C-I, D-III

    Explanation

    Sign in to read the full explanation
  93. What is the safest order while simplifying Context Free Grammar?

    1. AElimination of ε-productions, Unit productions and then Useless symbols & productions.
    2. BElimination of useless symbols & productions, ε-productions and then Unit productions.
    3. CElimination of Unit productions, ε-productions and then Useless symbols and productions.
    4. DElimination of ε-productions, Useless symbols and productions and then Unit productions.

    Answer: (A) Elimination of ε-productions, Unit productions and then Useless symbols & productions.

    Explanation

    Sign in to read the full explanation
  94. A Turing Machine for the language L={aⁿbᵐcⁿdᵐ | n≥1, m≥1} is designed. Part of its transition function 'δ' is given in a transition table, where X1 and X2 are used to work with 'a's and 'c's, and Y1 and Y2 are used to handle 'b's and 'd's of the given string. The table has state q1 moving right over 'a', 'b' and 'X2' while staying in q1, and reaching an unmarked 'c' triggers the move recorded as cell 'M1'.

    What is the move in cell 'M1'?

    qabcX1X2Y1Y2
    q0(q1,X1,R)M2
    q1(q1,a,R)(q1,b,R)M1(q1,X2,R)
    q2(q2,a,L)(q2,b,L)(q2,X1,R)(q2,X2,L)
    q3M3(q4,Y1,R)(q6,X2,R)
    q4(q4,b,R)(q5,Y2,L)M5(q4,Y2,R)
    q5(q5,b,L)(q5,X2,L)M4(q5,Y2,L)
    q6(q6,X2,R)(q7,Y2,R)
    q7(q7,Y2,R)

    Partial transition table for the Turing machine, with cells M1-M5 to be determined

    1. A(q2,X2,R)
    2. B(q2,X2,L)
    3. C(q3,X2,L)
    4. DError Entry

    Answer: (B) (q2,X2,L)

    Explanation

    Sign in to read the full explanation
  95. A Turing Machine for the language L={aⁿbᵐcⁿdᵐ | n≥1, m≥1} is designed. Part of its transition function 'δ' is given in a transition table, where X1 and X2 are used to work with 'a's and 'c's, and Y1 and Y2 are used to handle 'b's and 'd's of the given string. In this table, state q0 marks the leftmost unmarked 'a' as X1 and moves right, and seeing an already-marked 'X1' triggers the move recorded as cell 'M2'.

    What is the move in cell 'M2'?

    qabcX1X2Y1Y2
    q0(q1,X1,R)M2
    q1(q1,a,R)(q1,b,R)M1(q1,X2,R)
    q2(q2,a,L)(q2,b,L)(q2,X1,R)(q2,X2,L)
    q3M3(q4,Y1,R)(q6,X2,R)
    q4(q4,b,R)(q5,Y2,L)M5(q4,Y2,R)
    q5(q5,b,L)(q5,X2,L)M4(q5,Y2,L)
    q6(q6,X2,R)(q7,Y2,R)
    q7(q7,Y2,R)

    Partial transition table for the Turing machine, with cells M1-M5 to be determined

    1. A(q1,X1,R)
    2. B(q1,a,R)
    3. C(q2,X1,R)
    4. DError Entry

    Answer: (D) Error Entry

    Explanation

    Sign in to read the full explanation
  96. A Turing Machine for the language L={aⁿbᵐcⁿdᵐ | n≥1, m≥1} is designed. Part of its transition function 'δ' is given in a transition table, where X1 and X2 are used to work with 'a's and 'c's, and Y1 and Y2 are used to handle 'b's and 'd's of the given string. In this table, state q3 is reached after the a-c marking phase, and seeing an unmarked 'a' from q3 triggers the move recorded as cell 'M3'.

    What is the move in cell 'M3'?

    qabcX1X2Y1Y2
    q0(q1,X1,R)M2
    q1(q1,a,R)(q1,b,R)M1(q1,X2,R)
    q2(q2,a,L)(q2,b,L)(q2,X1,R)(q2,X2,L)
    q3M3(q4,Y1,R)(q6,X2,R)
    q4(q4,b,R)(q5,Y2,L)M5(q4,Y2,R)
    q5(q5,b,L)(q5,X2,L)M4(q5,Y2,L)
    q6(q6,X2,R)(q7,Y2,R)
    q7(q7,Y2,R)

    Partial transition table for the Turing machine, with cells M1-M5 to be determined

    1. A(q1,X1,L)
    2. B(q4,X1,R)
    3. C(q1,X1,R)
    4. DError Entry

    Answer: (C) (q1,X1,R)

    Explanation

    Sign in to read the full explanation
  97. A Turing Machine for the language L={aⁿbᵐcⁿdᵐ | n≥1, m≥1} is designed. Part of its transition function 'δ' is given in a transition table, where X1 and X2 are used to work with 'a's and 'c's, and Y1 and Y2 are used to handle 'b's and 'd's of the given string. In this table, state q5 moves left over 'b', already-marked 'X2' and already-marked 'Y2', and seeing an already-marked 'Y1' triggers the move recorded as cell 'M4'.

    What is the move in cell 'M4'?

    qabcX1X2Y1Y2
    q0(q1,X1,R)M2
    q1(q1,a,R)(q1,b,R)M1(q1,X2,R)
    q2(q2,a,L)(q2,b,L)(q2,X1,R)(q2,X2,L)
    q3M3(q4,Y1,R)(q6,X2,R)
    q4(q4,b,R)(q5,Y2,L)M5(q4,Y2,R)
    q5(q5,b,L)(q5,X2,L)M4(q5,Y2,L)
    q6(q6,X2,R)(q7,Y2,R)
    q7(q7,Y2,R)

    Partial transition table for the Turing machine, with cells M1-M5 to be determined

    1. A(q5,Y1,L)
    2. B(q3,Y1,R)
    3. C(q4,Y1,L)
    4. D(q3,Y1,L)

    Answer: (A) (q5,Y1,L)

    Explanation

    Sign in to read the full explanation
  98. A Turing Machine for the language L={aⁿbᵐcⁿdᵐ | n≥1, m≥1} is designed. Part of its transition function 'δ' is given in a transition table, where X1 and X2 are used to work with 'a's and 'c's, and Y1 and Y2 are used to handle 'b's and 'd's of the given string. In this table, state q4 moves right over 'b' and already-marked 'Y2' while heading toward the next unmarked 'c', and seeing an already-marked 'X2' triggers the move recorded as cell 'M5'.

    What is the move in cell 'M5'?

    qabcX1X2Y1Y2
    q0(q1,X1,R)M2
    q1(q1,a,R)(q1,b,R)M1(q1,X2,R)
    q2(q2,a,L)(q2,b,L)(q2,X1,R)(q2,X2,L)
    q3M3(q4,Y1,R)(q6,X2,R)
    q4(q4,b,R)(q5,Y2,L)M5(q4,Y2,R)
    q5(q5,b,L)(q5,X2,L)M4(q5,Y2,L)
    q6(q6,X2,R)(q7,Y2,R)
    q7(q7,Y2,R)

    Partial transition table for the Turing machine, with cells M1-M5 to be determined

    1. A(q4,X2,R)
    2. B(q5,X2,R)
    3. C(q5,X2,L)
    4. DError Entry

    Answer: (A) (q4,X2,R)

    Explanation

    Sign in to read the full explanation
  99. In Pumping Lemma for context free languages, to say a language is satisfying pumping lemma, what is the minimum length of 'vx' together, if you consider the string as 'uvwxy'?

    1. A0
    2. B1
    3. C2
    4. Dn

    Answer: (B) 1

    Explanation

    Sign in to read the full explanation
  100. Which of the following is ε-free grammar?

    1. AType-0
    2. BType-1
    3. CType-2
    4. DType-3

    Answer: (B) Type-1

    Explanation

    Sign in to read the full explanation
  101. While processing a string by an LR parser, the reading of the given string by the parser is--------------.

    1. AFrom right to left
    2. BFrom left to right
    3. CCan be either from left to right or right to left
    4. DFrom the centre of the given string

    Answer: (B) From left to right

    Explanation

    Sign in to read the full explanation
  102. What is the minimum and maximum number of initial, dead, unreachable and final states in a valid 'n' state finite automaton, where the language accepted is not 'Φ'?

    1. AMinimum: 1,1,1,1; Maximum: 1, (n-1), (n-1), n
    2. BMinimum: 1,0,0,0; Maximum: 1, (n-1), (n-1), n
    3. CMinimum: 1,0,0,n; Maximum: 1, n, (n-1), (n-1)
    4. DMinimum: 1,0,0,1; Maximum: 1, (n-1), (n-1), n

    Answer: (D) Minimum: 1,0,0,1; Maximum: 1, (n-1), (n-1), n

    Explanation

    Sign in to read the full explanation
  103. Question 100

    UGC NET March 2023

    Which of the following Finite Automata, recognizes the language L={a,b}* ?

    A. M=({q0}, {a,b}, δ, q0, {q0}) where q0 transitions to {q0} on both a and b.
    B. M=({q0,q1}, {a,b}, δ, q0, {q0,q1}) where q0 transitions to {q0,q1} on both a and b, and q1 transitions to {q1} on both a and b.
    C. M=({q0,q1}, {a,b}, δ, q0, {q0,q1}) where q0 transitions to {q0,q1} on a and to {q0} on b, and q1 has no transition on a and transitions to {q1} on b.
    D. M=({q0,q1,q2}, {a,b}, δ, q0, {q0}) where q0 transitions to {q0} on both a and b, q1 transitions to {q2} on a and has no transition on b, and q2 transitions to {q0} on a and to {q2} on b.

    1. AA and B
    2. BA and D
    3. CA, B and C
    4. DA, B, C and D

    Answer: (D) A, B, C and D

    Explanation

    Sign in to read the full explanation
  104. Practise Theory of Computation and Compilers in a timed set
  105. Question 101

    UGC NET March 2023

    Which of the following statement(s) are correct?

    A. Syntax Directed Translation can be applied in Type Checking.
    B. Syntax Directed Translation can be used in 3-address code generation.
    C. Syntax Directed Translation can be used in construction of syntax tree.
    D. Syntax Directed Translation can be used to recognize valid tokens.

    Choose the most appropriate answer from the options given below:

    1. AA, B and C
    2. BA, B, C and D
    3. CA, C and D
    4. DB, C and D

    Answer: (A) A, B and C

    Explanation

    Sign in to read the full explanation
  106. Question 102

    UGC NET March 2023

    Match List I with List II.

    List-IList-II
    A. Initial Configuration of stack and input in LL Parsing processI. $ w$
    B. Final Configuration of stack and input in LL Parsing processII. $ $
    C. Initial Configuration of stack and input in LR Parsing processIII. $S w$
    D. Final Configuration of stack and input in LR Parsing processIV. $S $
    1. AA-III, B-IV, C-I, D-II
    2. BA-III, B-II, C-I, D-IV
    3. CA-II, B-III, C-IV, D-I
    4. DA-II, B-IV, C-I, D-III

    Answer: (A) A-III, B-IV, C-I, D-II

    Explanation

    Sign in to read the full explanation
  107. Question 103

    UGC NET March 2023

    The precedence of regular expression operators from lowest to highest precedence is:

    1. AStar, Concatenation, Union
    2. BUnion, Star, Concatenation
    3. CUnion, Concatenation, Star
    4. DStar, Union, Concatenation

    Answer: (C) Union, Concatenation, Star

    Explanation

    Sign in to read the full explanation
  108. Question 104

    UGC NET March 2023

    Consider the following statements:

    A. For every regular language, we can design a Turing Machine
    B. For every context free language, we can design a Turing Machine

    Which of the following is correct?

    1. AStatement-A is false and Statement-B is true.
    2. BStatement-A and Statement-B both are false.
    3. CStatement-A is true and Statement-B is false.
    4. DStatement-A and Statement-B both are true.

    Answer: (D) Statement-A and Statement-B both are true.

    Explanation

    Sign in to read the full explanation
  109. 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. AS → CA, A → a, C → b
    2. BS → CA | B, B → BC | B, A → a, C → aB | b
    3. CS → CA | B, B → BC, A → a, C → aB | b
    4. DS → AB | AC, B → BC | BA, A → a, C → aB | b

    Answer: (A) S → CA, A → a, C → b

    Explanation

    Sign in to read the full explanation
  110. Consider the production rules of grammer G:
    S → AbB
    A → aAb | λ
    B → bB | λ
    Which of the following language L is generated by grammer G?

    1. AL = {aⁿbᵐ : n ≥ 0, m > n}
    2. BL = {aⁿbᵐ : n ≥ 0, m ≥ 0}
    3. CL = {aⁿbᵐ : n ≥ m}
    4. DL = {aⁿbᵐ : n ≥ m, m > 0}

    Answer: (A) L = {aⁿbᵐ : n ≥ 0, m > n}

    Explanation

    Sign in to read the full explanation
  111. Consider the language L = {aⁿbᵐ : n ≥ 4, m ≤ 3}. Which of the following regular expression represents language L?

    1. Aaaaa*(λ + b + bb + bbb)
    2. Baaaaa*(b + bb + bbb)
    3. Caaaaa*(λ + b + bb + bbb)
    4. Daaaa*(b + bb + bbb)

    Answer: (C) aaaaa*(λ + b + bb + bbb)

    Explanation

    Sign in to read the full explanation
  112. Consider L = {ab, aa, baa}. Which of the following string is NOT in L*?

    1. Abaaaaabaaaaa
    2. Babaabaaabaa
    3. Caaaabaaaa
    4. Dbaaaaabaa

    Answer: (A) baaaaabaaaaa

    Explanation

    Sign in to read the full explanation
  113. Consider the following NPDA = ({q₀, q₁, qf}, {a,b}, {1,z}, δ, q₀, z, {qf})
    δ(q₀, λ, z) = {(q₁, z)}
    δ(q₀, a, z) = {(q₁, 11z)}
    δ(q₁, a, 1) = {(q₁, 111)}
    δ(q₁, b, 1) = {(q₁, λ)}
    δ(q₁, λ, z) = {(qf, z)}
    Which of the following Language L is accepted by NPDA?

    1. AL = {a²ⁿbⁿ : n ≥ 0}
    2. BL = {aⁿb²ⁿ : n ≥ 0}
    3. CL = {a²ⁿbⁿ : n > 0}
    4. DL = {aⁿb²ⁿ : n > 0}

    Answer: (B) L = {aⁿb²ⁿ : n ≥ 0}

    Explanation

    Sign in to read the full explanation
  114. Consider two lists A and B of three strings on {0,1}.
    X: (1,111), (10111,10), (10,0)
    Y: (10,101), (011,11), (101,011)
    Which of the following is true?

    1. AOnly PCP in X has solution.
    2. BOnly PCP in Y has solution.
    3. CPCP in both X and Y has solution.
    4. DPCP neither in X nor in Y has solution.

    Answer: (A) Only PCP in X has solution.

    Explanation

    Sign in to read the full explanation
  115. Consider the properties of recursively enumerable sets:
    A. Finiteness
    B. Context Freedom
    C. Emptiness
    Which of the following is true?

    1. AOnly (A) and (B) are not decidable
    2. BOnly (B) and (C) are not decidable
    3. COnly (C) and (A) are not decidable
    4. DAll (A), (B) and (C) are not decidable

    Answer: (D) All (A), (B) and (C) are not decidable

    Explanation

    Sign in to read the full explanation
  116. Consider the grammer S → SbS | a.
    Consider the following statements:
    The string abababa has
    A. two parse trees
    B. two left most derivations
    C. two right most derivations
    Which of the following is correct?

    1. AAll (A), (B) and (C) are true
    2. BOnly (B) is true
    3. COnly (C) is true
    4. DOnly (A) is true

    Answer: (A) All (A), (B) and (C) are true

    Explanation

    Sign in to read the full explanation
  117. Match List I with List II regarding the Chomsky hierarchy.

    List-IList-II
    A. Type 0I. Finite automata
    B. Type 1II. Turing machine
    C. Type 2III. Linear bound automata
    D. Type 3IV. Pushdown automata
    1. A(A)-(III), (B)-(IV), (C)-(II), (D)-(I)
    2. B(A)-(II), (B)-(III), (C)-(IV), (D)-(I)
    3. C(A)-(III), (B)-(IV), (C)-(I), (D)-(II)
    4. D(A)-(II), (B)-(III), (C)-(II), (D)-(IV)

    Answer: (B) (A)-(II), (B)-(III), (C)-(IV), (D)-(I)

    Explanation

    Sign in to read the full explanation
  118. Consider the following statements:
    Statement I: LALR parser is more powerful than canonical LR Parser.
    Statement II: SLR parser is more powerful than LALR
    Which of the following is correct?

    1. AStatement I true and Statement II false
    2. BStatement I false and Statement II true
    3. CBoth Statement I and Statement II false
    4. DBoth Statement I and Statement II true

    Answer: (C) Both Statement I and Statement II false

    Explanation

    Sign in to read the full explanation
  119. Consider the following statements about Context Free Language (CFL):
    Statement I: CFL is closed under homomorphism.
    Statement II: CFL is closed under complement.
    Which of the following is correct?

    1. AStatement I is true and Statement II is false
    2. BStatement II is true and Statement I is false
    3. CBoth Statement I and Statement II are true
    4. DNeither Statement I nor Statement II is true

    Answer: (A) Statement I is true and Statement II is false

    Explanation

    Sign in to read the full explanation
  120. Which of the following languages are NOT regular?

    A. L = { (01)^n 0^k : n > k, k >= 0 }
    B. L = { c^n b^k a^(n+k) : n >= 0, k >= 0 }
    C. L = { 0^n 1^k : n is not equal to k }

    Choose the correct answer from the options given below:

    1. AA and B only
    2. BA and C only
    3. CB and C only
    4. DA, B and C

    Answer: (D) A, B and C

    Explanation

    Sign in to read the full explanation
  121. Any string of terminals generated by the following context-free grammar (S is the start symbol):

    S -> XY
    X -> 0X | 1X | 0
    Y -> Y0 | Y1 | 0
    
    1. Ahas at least one 1
    2. Bshould end with 0
    3. Chas no consecutive 0's or 1's
    4. Dhas at least two 0's

    Answer: (D) has at least two 0's

    Explanation

    Sign in to read the full explanation
  122. Let L1 = { 0^n 1^n 0^m : n >= 1, m >= 1 }, L2 = { 0^n 1^m 0^m : n >= 1, m >= 1 }, L3 = { 0^n 1^n 0^n : n >= 1 }. Which statements are correct?

    A. L3 = L1 intersect L2
    B. L1 and L2 are context-free languages but L3 is not.
    C. L1 and L2 are not context-free but L3 is.
    D. L1 is a subset of L3.

    Choose the correct answer from the options given below:

    1. AA and B only
    2. BA and C only
    3. CA and D only
    4. DA only

    Answer: (A) A and B only

    Explanation

    Sign in to read the full explanation
  123. Statement I: The family of context-free languages is closed under homomorphism.
    Statement II: The family of context-free languages is closed under reversal.

    In light of the above statements, choose the correct answer from the options given below:

    1. ABoth Statement I and Statement II are true
    2. BBoth Statement I and Statement II are false
    3. CStatement I is true but Statement II is false
    4. DStatement I is false but Statement II is true

    Answer: (A) Both Statement I and Statement II are true

    Explanation

    Sign in to read the full explanation
  124. What is the minimum number of states in the finite automaton equivalent to the transition diagram shown?

    State transition diagram of a finite automaton over input alphabet {0, 1} with start state a and accepting state c.

    State transition diagram of a finite automaton over input alphabet {0, 1} with start state a and accepting state c.

    1. A3
    2. B4
    3. C5
    4. D6

    Answer: (C) 5

    Explanation

    Sign in to read the full explanation
  125. Find a regular expression for the language accepted by the automaton shown.

    A three-state finite automaton over {a, b} whose leftmost state is both the start state and the only accepting state.

    A three-state finite automaton over {a, b} whose leftmost state is both the start state and the only accepting state.

    1. A(aa*(a + b)ab)*
    2. B(a + b)ab(ab + bb + aa*(a + b)ab)*
    3. Caab(ab + bb + aa(a + b)ab)*
    4. Da*(a + b)ab(ab + bb + aa*(a + b)ab)*

    Answer: (B) (a + b)ab(ab + bb + aa*(a + b)ab)*

    Explanation

    Sign in to read the full explanation
  126. What language is accepted by the pushdown automaton M = ({q0, q1, q2}, {a, b}, {a, b, z}, delta, q0, z, {q2}) with the following transitions?

    delta(q0, a, a) = {(q0, aa)}     delta(q0, b, a) = {(q0, ba)}
    delta(q0, a, b) = {(q0, ab)}     delta(q0, b, b) = {(q0, bb)}
    delta(q0, a, z) = {(q0, az)}     delta(q0, b, z) = {(q0, bz)}
    delta(q0, lambda, a) = {(q1, a)} delta(q0, lambda, b) = {(q1, b)}
    delta(q1, a, a) = {(q1, lambda)} delta(q1, b, b) = {(q1, lambda)}
    delta(q1, lambda, z) = {(q2, z)}
    
    1. AL = { w : na(w) = nb(w), w in {a, b}+ }
    2. BL = { w : na(w) <= nb(w), w in {a, b}+ }
    3. CL = { w : nb(w) <= na(w), w in {a, b}+ }
    4. DL = { w w^R : w in {a, b}+ }

    Answer: (D) L = { w w^R : w in {a, b}+ }

    Explanation

    Sign in to read the full explanation
  127. Match List-I (Production Rules) with List-II (Grammar type).

    List-IList-II
    A. S -> XY; X -> 0; Y -> 1I. Greibach Normal Form
    B. S -> aS | bSS | cII. Context sensitive Grammar
    C. S -> AB; A -> 0A | 1A | 0; B -> 0AIII. Chomsky Normal Form
    D. S -> aAbc; Ab -> bA; Ac -> Bbcc; bB -> Bb; aB -> aa | aaAIV. S-Grammar
    1. AA-III, B-I, C-IV, D-II
    2. BA-III, B-II, C-I, D-IV
    3. CA-III, B-IV, C-I, D-II
    4. DA-IV, B-III, C-I, D-II

    Answer: (C) A-III, B-IV, C-I, D-II

    Explanation

    Sign in to read the full explanation
  128. Which of the following concepts can be used to identify loops?

    A. Depth-first ordering
    B. Dominators
    C. Reducible graphs

    Choose the correct answer from the options given below:

    1. AA and B only
    2. BA and C only
    3. CB and C only
    4. DA, B and C

    Answer: (D) A, B and C

    Explanation

    Sign in to read the full explanation
  129. Statement I: LL(1) and LR are examples of bottom-up parsers.
    Statement II: Recursive descent parser and SLR are examples of top-down parsers.

    In light of the above statements, choose the correct answer from the options given below:

    1. ABoth Statement I and Statement II are true
    2. BBoth Statement I and Statement II are false
    3. CStatement I is true but Statement II is false
    4. DStatement I is false but Statement II is true

    Answer: (B) Both Statement I and Statement II are false

    Explanation

    Sign in to read the full explanation
  130. Practise Theory of Computation and Compilers in a timed set
  131. Consider L = L₁ ∩ L₂, where L₁ = {0ᵐ1ᵐ20ⁿ1ⁿ | m, n ≥ 0} and L₂ = {0ᵐ1ⁿ2ᵏ | m, n, k ≥ 0}. Then L is

    1. ARecursively enumerable but not context-free
    2. BRegular
    3. CContext-free but not regular
    4. DNot recursive

    Answer: (C) Context-free but not regular

    Explanation

    Sign in to read the full explanation
  132. Let L₁ and L₂ over Σ = {a, b} be represented by (a* + b)* and (a + b)* respectively. Which statement is true?

    1. AL₁ ⊂ L₂
    2. BL₂ ⊂ L₁
    3. CL₁ = L₂
    4. DL₁ ∩ L₂ = ∅

    Answer: (C) L₁ = L₂

    Explanation

    Sign in to read the full explanation
  133. Which statement is true?

    1. AThe union of two context-free languages is context-free.
    2. BThe intersection of two context-free languages is context-free.
    3. CThe complement of a context-free language is context-free.
    4. DEvery context-free language can be accepted by a deterministic pushdown automaton.

    Answer: (A) The union of two context-free languages is context-free.

    Explanation

    Sign in to read the full explanation
  134. Which of the following is not an intermediate code form?

    1. ASyntax trees
    2. BThree-address codes
    3. CQuadruples
    4. DPostfix notation

    Answer: (A) Syntax trees

    Explanation

    Sign in to read the full explanation
  135. Which of the following are applications of a compiler symbol table?
    A. Storage allocation
    B. Checking type compatibility
    C. Suppressing duplicate-error messages

    1. A(A) and (B) only
    2. B(A) and (C) only
    3. C(B) and (C) only
    4. D(A), (B), and (C)

    Answer: (D) (A), (B), and (C)

    Explanation

    Sign in to read the full explanation
  136. Let G₁ and G₂ be arbitrary context-free grammars and R an arbitrary regular language. Which problems are undecidable?
    A. Is L(G₁) = L(G₂)?
    B. Is L(G₁) ⊂ L(G₂)?
    C. Is L(G₁) = R?

    1. A(A) only
    2. B(B) only
    3. C(A) and (B) only
    4. D(A), (B), and (C)

    Answer: (D) (A), (B), and (C)

    Explanation

    Sign in to read the full explanation
  137. Consider the languages

    L₁ = {aᶻ | z is an integer},
    L₂ = {a²ᶻ | z > 0}, and
    L₃ = {ww | w ∈ {a,b}*}.

    Which are regular?

    1. AL₁ and L₂ only
    2. BL₁ and L₃ only
    3. CL₂ only
    4. DL₃ only

    Answer: (A) L₁ and L₂ only

    Explanation

    Sign in to read the full explanation
  138. Which grammars are ambiguous?
    A. S → SS | aSb | bSa | a
    B. S → aSbS | bSaS | ε
    C. S → aAB; A → bBb; B → A | ε

    1. A(A) and (C) only
    2. B(A) and (B) only
    3. C(B) and (C) only
    4. D(A), (B), and (C)

    Answer: (D) (A), (B), and (C)

    Explanation

    Sign in to read the full explanation
  139. Match List I with List II:
    Lz: Regular language. LCF: Context free language

    Lec: Recursive language, Lpz: Recursively enumerable language.

    List I List II
    A. Recursively Enumerable language @ LpecULnx
    B. Recursive language CQ). ‘Fee Base
    C. Context Free language (II) Le A Ler

    List IList II
    Items are listed in the question stem.Match each item to its stated description or complexity.
    1. AOCR review required
    2. BOCR review required
    3. CALI, B-II, C-II (4) A-II, B-I, C-III
    4. DOCR review required

    Answer: (C) ALI, B-II, C-II (4) A-II, B-I, C-III

    Explanation

    Sign in to read the full explanation
  140. Consider the following regular expressions:
    (a) r=a(b+a)*

    (b) s=a(a+b)*

    (c) t=aa*b

    1. AOCR review required
    2. BOCR review required
    3. CL(r)DL(t)D L(s) (4) L(s)aL(t)DL(r)
    4. DOCR review required

    Answer: (B) OCR review required

    Explanation

    Sign in to read the full explanation
  141. Given below are two statements:
    Statement I: The problem "Is L; AL; = $?" is undecidable for context sensitive languages
    L, and L3.
    Statement II: The problem "Is WeL?" is decidable for context sensitive language L, (where
    W isa string).
    In the light of the above statements, choose the correct answer from the options given below
    qd) Both Statement I and Statement II are true

    1. AOCR review required
    2. BBoth Statement I and Statement II are false
    3. CStatement I is correct but Statement II is false
    4. DStatement I is incorrect but Statement II is true.

    Answer: (A) OCR review required

    Explanation

    Sign in to read the full explanation
  142. Consider the following statements with respect to the language L = {aⁿbⁿ | n ≥ 0}:

    Statement I: L² is context free language.
    Statement II: Lᵏ is context-free language for any given k ≥ 1.
    Statement III: L̅ and L* are context free languages.

    Which one of the following is correct?

    1. AOnly Statement I and Statement II
    2. BOnly Statement I and Statement III
    3. COnly Statement II and Statement III
    4. DStatement I, Statement II and Statement III

    Answer: (D) Statement I, Statement II and Statement III

    Explanation

    Sign in to read the full explanation
  143. Consider the following grammars:

    G₁: S → aSb | bSa | SS | ε
    G₂: S → aSb | bSa | SS | a
    G₃: S → aSb | bSa | SS | SSS | λ

    Which of the following is correct w.r.t. the above grammars?

    1. AG₁ and G₂ are equivalent
    2. BG₁ and G₃ are equivalent
    3. CG₂ and G₃ are equivalent
    4. DG₁, G₂ and G₃ are equivalent

    Answer: (B) G₁ and G₃ are equivalent

    Explanation

    Sign in to read the full explanation
  144. Consider the following statements:

    Statement I: There exists no algorithm for deciding if any two Turing machines M₁ and M₂ accept the same language.
    Statement II: Let M₁ and M₂ be arbitrary Turing machines. The problem to determine L(M₁) ⊆ L(M₂) is undecidable.

    Which of the statements is (are) correct?

    1. AOnly Statement I
    2. BOnly Statement II
    3. CBoth Statement I and Statement II
    4. DNeither Statement I nor Statement II

    Answer: (C) Both Statement I and Statement II

    Explanation

    Sign in to read the full explanation
  145. Consider the following grammar:

    S → 0A | 0BB
    A → 00A | λ
    B → 1B | 11C
    C → B

    Which language does this grammar generate?

    1. AL((00)*0 + (11)*1)
    2. BL(0(11)* + 1(00)*)
    3. CL((00)*0)
    4. DL(0(11)*1)

    Answer: (C) L((00)*0)

    Explanation

    Sign in to read the full explanation
  146. Consider the following language families:

    L₁ = The context-free languages
    L₂ = The context-sensitive languages
    L₃ = The recursively enumerable languages
    L₄ = The recursive languages

    Which one of the following options is correct?

    1. AL₁ ⊂ L₂ ⊂ L₄ ⊂ L₃
    2. BL₁ ⊂ L₄ ⊂ L₂ ⊂ L₃
    3. CL₄ ⊂ L₁ ⊂ L₂ ⊂ L₃
    4. DL₁ ⊂ L₂ ⊂ L₃ ⊂ L₄

    Answer: (A) L₁ ⊂ L₂ ⊂ L₄ ⊂ L₃

    Explanation

    Sign in to read the full explanation
  147. Let G = (V, T, S, P) be any context-free grammar without any λ-productions or unit productions. Let K be the maximum number of symbols on the right of any production in P. The maximum number of production rules for any equivalent grammar in Chomsky normal form is given by:

    1. A(K-1)|P| + |T| - 1
    2. B(K-1)|P| + |T|
    3. CK|P| + |T| - 1
    4. DK|P| + |T|

    Answer: (B) (K-1)|P| + |T|

    Explanation

    Sign in to read the full explanation
  148. Consider the language L = {aⁿbⁿ⁻³ | n > 2} on Σ = {a, b}. Which one of the following grammars generates the language L?

    1. AS → aA | a, A → aAb | b
    2. BS → aaA | λ, A → aAb | λ
    3. CS → aaaA | a, A → aAb | λ
    4. DS → aaaA, A → aAb | λ

    Answer: (D) S → aaaA, A → aAb | λ

    Explanation

    Sign in to read the full explanation
  149. Consider the following languages:

    L₁ = {aⁿbⁿcᵐ} ∪ {aⁿbᵐcᵐ}, n, m ≥ 0
    L₂ = {wwᴿ | w ∈ {a, b}*} where R represents reversible operation.

    Which one of the following is (are) inherently ambiguous language(s)?

    1. Aonly L₁
    2. Bonly L₂
    3. Cboth L₁ and L₂
    4. Dneither L₁ nor L₂

    Answer: (A) only L₁

    Explanation

    Sign in to read the full explanation
  150. Let A = {001, 0011, 11, 101} and B = {01, 111, 111, 010}. Similarly, let C = {00, 001, 1000} and D = {0, 11, 011}.
    Which of the following pairs have a post-correspondence solution?

    1. AOnly pair (A, B)
    2. BOnly pair (C, D)
    3. CBoth (A, B) and (C, D)
    4. DNeither (A, B) nor (C, D)

    Answer: (A) Only pair (A, B)

    Explanation

    Sign in to read the full explanation
  151. Consider Σ = {w, x} and T = {x, y, z}. Define homomorphism h by:

    h(x) = xzy
    h(w) = zxyy

    If L is the regular language denoted by r = (w + x*)(ww)*, then the regular language h(L) is given by:

    1. A(zxyy + xzy)(zxyy)
    2. B(zxyy + (xzy))(zxyyzxyy)
    3. C(zxyy + xzy)(zxyy)*
    4. D(zxyy + (xzy)*)(zxyyzxyy)

    Answer: (B) (zxyy + (xzy))(zxyyzxyy)

    Explanation

    Sign in to read the full explanation
  152. Question 147

    UGC NET June 2019

    On translating the expression given below into quadruple representation, how many operations are required?
    (ij) + (e + f) * (ab + c)

    1. A5
    2. B6
    3. C3
    4. D7

    Answer: (B) 6

    Explanation

    Sign in to read the full explanation
  153. Question 148

    UGC NET June 2019

    How many states are there in a minimum state automata equivalent to regular expression given below?
    Regular expression is a*b(a+b)

    1. A1
    2. B2
    3. C3
    4. D4

    Answer: (D) 4

    Explanation

    Sign in to read the full explanation
  154. Question 149

    UGC NET June 2019

    Shift-reduce parser consists of
    (a) input buffer
    (b) stack
    (c) parse table

    Choose the correct option from those give below:

    1. A(a) and (b) only
    2. B(a) and (c) only
    3. C(c) only
    4. D(a), (b) and (c)

    Answer: (D) (a), (b) and (c)

    Explanation

    Sign in to read the full explanation
  155. Question 150

    UGC NET June 2019

    Which data structure is used by the compiler for managing variables and their attributes?

    1. ABinary tree
    2. BLink list
    3. CSymbol table
    4. DParse table

    Answer: (C) Symbol table

    Explanation

    Sign in to read the full explanation
  156. Practise Theory of Computation and Compilers in a timed set
  157. Question 151

    UGC NET June 2019

    For a statement
    A language L ⊆ Σ* is recursive if there exists some turing machine M.
    Which of the following conditions is satisfied for any string ω?

    1. AIf ω ∈ L, then M accepts ω and M will not halt
    2. BIf ω ∉ L, then M accepts ω and M will halt by reaching at final state
    3. CIf ω ∉ L, then M halts without reaching to acceptable state
    4. DIf ω ∈ L, then M halts without reaching to an acceptable state

    Answer: (C) If ω ∉ L, then M halts without reaching to acceptable state

    Explanation

    Sign in to read the full explanation
  158. Question 152

    UGC NET June 2019

    How can the decision algorithm be constructed for deciding whether context-free language L is finite?
    (a) By constructing redundant CFG G in CNF generating language L
    (b) By constructing non-redundant CFG G in CNF generating language L
    (c) By constructing non-redundant CFG G in CNF generating language L - {ε} (ε stands for null)

    Which of the following is correct?

    1. A(a) only
    2. B(b) only
    3. C(c) only
    4. DNone of (a), (b) and (c)

    Answer: (C) (c) only

    Explanation

    Sign in to read the full explanation
  159. Question 153

    UGC NET June 2019

    Which of the following problems is/are decidable problem(s) (recursively enumerable) on turing machine M?
    (a) G is a CFG with L(G) = φ
    (b) There exist two TMs M₁ and M₂ such that L(M) ⊆ {L(M₁) ∪ L(M₂)} = language of all TMs
    (c) M is a TM that accepts ω using at most 2^{|ω|} cells of tape

    1. A(a) and (b) only
    2. B(a) only
    3. C(a), (b) and (c)
    4. D(c) only

    Answer: (B) (a) only

    Explanation

    Sign in to read the full explanation
  160. Question 154

    UGC NET June 2019

    Match List-I with List-II:
    where L₁: Regular language
    L₂: Context-free language
    L₃: Recursive language
    L₄: Recursively enumerable language

    List-IList-II
    (a) L̄₃ ∪ L₄(i) Context-free language
    (b) L̄₂ ∪ L₃(ii) Recursively enumerable language
    (c) L₁* ∩ L₂(iii) Recursive language
    1. A(a)-(ii); (b)-(i); (c)-(iii)
    2. B(a)-(ii); (b)-(iii); (c)-(i)
    3. C(a)-(iii); (b)-(i); (c)-(ii)
    4. D(a)-(i); (b)-(ii); (c)-(iii)

    Answer: (B) (a)-(ii); (b)-(iii); (c)-(i)

    Explanation

    Sign in to read the full explanation
  161. Question 155

    UGC NET June 2019

    Replacing the expression 4 * 2.14 by 8.56 is known as

    1. Aconstant folding
    2. Binduction variable
    3. Cstrength reduction
    4. Dcode reduction

    Answer: (A) constant folding

    Explanation

    Sign in to read the full explanation
  162. Question 156

    UGC NET June 2019

    Consider the following grammar:
    S → XY
    X → YaY | a and Y → bbX

    Which of the following statements is/are true about the above grammar?
    (a) Strings produced by the grammar can have consecutive three a's.
    (b) Every string produced by the grammar have alternate a and b.
    (c) Every string produced by the grammar have at least two a's.
    (d) Every string produced by the grammar have b's in multiple of 2.

    1. A(a) only
    2. B(b) and (c) only
    3. C(d) only
    4. D(c) and (d) only

    Answer: (D) (c) and (d) only

    Explanation

    Sign in to read the full explanation
  163. Question 157

    UGC NET June 2019

    Consider the complexity class CO - NP as the set of languages L such that L̄ ∈ NP, and the following two statements:
    S₁: P ⊆ CO-NP
    S₂: If NP ≠ CO-NP, then P ≠ NP

    Which of the following is/are correct?

    1. AOnly S₁
    2. BOnly S₂
    3. CBoth S₁ and S₂
    4. DNeither S₁ nor S₂

    Answer: (C) Both S₁ and S₂

    Explanation

    Sign in to read the full explanation
  164. Let r = a(a + b), s = aab and t = a*b be three regular expressions. Consider the following :

    (i) L(s) ⊆ L(r) and L(s) ⊆ L(t)
    (ii) L(r) ⊆ L(S) and L(S) ⊆ L(t)

    Choose the correct answer from the code given below :
    Code :

    1. ANeither (i) nor (ii) is correct.
    2. BOnly (ii) is correct.
    3. CBoth (i) and (ii) are correct.
    4. DOnly (i) is correct.

    Answer: (D) Only (i) is correct.

    Explanation

    Sign in to read the full explanation
  165. Consider the following two languages :

    L1 = {x | for some y with |y| = 2|x|, xy ∈ L and L is regular language}
    L2 = {x | for some y such that |x| = |y|, xy ∈ L and L is regular language}

    Which one of the following is correct ?
    Code :

    1. ABoth L1 and L2 are regular language
    2. BOnly L1 is regular language
    3. COnly L2 is regular language
    4. DBoth L1 and L2 are not regular language

    Answer: (A) Both L1 and L2 are regular language

    Explanation

    Sign in to read the full explanation
  166. The number of substrings that can be formed from string given by

    a d e f b g h n m p

    is

    1. A55
    2. B56
    3. C10
    4. D45

    Answer: (B) 56

    Explanation

    Sign in to read the full explanation
  167. The grammar S → (S) | SS | ε is not suitable for predictive parsing because the grammar is

    1. AAn operator grammar
    2. BAmbiguous
    3. CLeft recursive
    4. DRight recursive

    Answer: (B) Ambiguous

    Explanation

    Sign in to read the full explanation
  168. Consider the following languages :

    L1 = {a^(n+m) b^n a^m | n, m ≥ 0}
    L2 = {a^(n+m) b^(n+m) a^(n+m) | n, m ≥ 0}

    Which one of the following is correct ?

    1. AOnly L2 is context free language
    2. BOnly L1 is context free language
    3. CBoth L1 and L2 are context free languages
    4. DBoth L1 and L2 are not context free languages

    Answer: (B) Only L1 is context free language

    Explanation

    Sign in to read the full explanation
  169. Consider the language L given by L = {2^n k | k > 0, and n is non-negative integer number}. The minimum number of states of finite automaton which accepts the language L is

    1. An + 1
    2. B2n
    3. Cn(n + 1)/2
    4. Dn

    Answer: (A) n + 1

    Explanation

    Sign in to read the full explanation
  170. Which of the following problems is decidable for recursive languages (L) ?

    1. AIs L = R, where R is a given regular set ?
    2. BIs L = ϕ ?
    3. CIs w ∈ L, where w is a string ?
    4. DIs L = Σ* ?

    Answer: (C) Is w ∈ L, where w is a string ?

    Explanation

    Sign in to read the full explanation
  171. Consider the following problems :

    (i) Whether a finite state automaton halts on all inputs ?
    (ii) Whether a given context free language is regular ?
    (iii) Whether a Turing machine computes the product of two numbers ?

    Which one of the following is correct ?
    Code :

    1. AOnly (i) and (iii) are undecidable problems
    2. BOnly (i) and (ii) are undecidable problems
    3. COnly (ii) and (iii) are undecidable problems
    4. D(i), (ii) and (iii) are undecidable problems

    Answer: (C) Only (ii) and (iii) are undecidable problems

    Explanation

    Sign in to read the full explanation
  172. Consider the following grammar G :

    S → A | B
    A → a | c
    B → b | c

    where {S, A, B}, the set of non-terminals, and {a, b, c}, the set of terminals.
    Which of the following statement(s) is/are correct ?

    S1 : LR(1) can parse all strings that are generated using grammar G.
    S2 : LL(1) can parse all strings that are generated using grammar G.

    Choose the correct answer from the code given below :
    Code :

    1. ANeither S1 nor S2
    2. BOnly S1
    3. COnly S2
    4. DBoth S1 and S2

    Answer: (A) Neither S1 nor S2

    Explanation

    Sign in to read the full explanation
  173. Consider R to be any regular language and L1, L2 be any two context-free languages. Which one of the following is correct ?

    1. AL1 – R is context free
    2. B(L1 ∪ L2) – R is context free
    3. CL1 ∩ L2 is context free
    4. DL̅1 is context free

    Answer: (A) L1 – R is context free

    Explanation

    Sign in to read the full explanation

Frequently asked questions

How many Theory of Computation and Compilers questions have been asked in UGC NET Computer Science?

167 Theory of Computation and Compilers questions appear in the UGC NET Computer Science papers held between 2018–2026, and all of them are on this page with their answer key.

Are the answers on this page free?

Yes. Every question, its options, and the correct answer are free to read with no account. Signing in additionally unlocks the detailed explanation under each question.

Is Theory of Computation and Compilers an important topic for UGC NET Computer Science?

Theory of Computation and Compilers appears in every recent UGC NET Computer Science paper, across all 14 sittings covered here. Its share of the paper makes it worth revising thoroughly rather than sampling.

How should I practise Theory of Computation and Compilers after reading these questions?

Attempt the Theory of Computation and Compilers topic-wise sets, which put the same questions into a timed interface with instant scoring and weak-area analysis afterwards.

More Computer Science PYQs by topic

More Computer Science practice

Ready for a full paper?

Attempt Paper 1 + Paper 2 (Computer Science) together in a single timed session.

Full Mock Tests →