Theory of computation miscellaneous


Theory of computation miscellaneous

Theory of Computation

  1. Which of the following pairs have different expressive power?









  1. View Hint View Answer Discuss in Forum

    DPDA and NPDA because an NPDA cannot be converted into DPDA.

    Correct Option: B

    DPDA and NPDA because an NPDA cannot be converted into DPDA.


  1. Which of the following is/are undecidable?
    1. G is a CFG. Is L(G) = Φ ?
    2. G is a CFG. Is L(G) = ∑* ?
    3. M is a Turing machine. Is L(M) regular?
    4. A is a DFA and N is an NFA. Is L(A) = L(N)?









  1. View Hint View Answer Discuss in Forum

    1. G is a CFG. Is L(G) = φ ?
    Decidable
    2. G is a CFG. Is L(G) = S * ?
    Undecidable
    3. M is a Turing Machine. Is L (M) regular ?
    Undecidable.
    4. A is a DFA and N is an NFA. Is L(A) = L(N) ?
    Decidable.
    Hence, the correct answer is (d) 2 and 3 only.

    Correct Option: D

    1. G is a CFG. Is L(G) = φ ?
    Decidable
    2. G is a CFG. Is L(G) = S * ?
    Undecidable
    3. M is a Turing Machine. Is L (M) regular ?
    Undecidable.
    4. A is a DFA and N is an NFA. Is L(A) = L(N) ?
    Decidable.
    Hence, the correct answer is (d) 2 and 3 only.



  1. In the context of Abstract-Systax-Tree (AST) and ControlFlow-Graph (CFG), which one of the following is TRUE?









  1. View Hint View Answer Discuss in Forum

    Option (a) is false when CFG contains cycle Option (b) is false as CFG can contain cycle Option (d) is false as a single node can contain block of statements.

    Correct Option: C

    Option (a) is false when CFG contains cycle Option (b) is false as CFG can contain cycle Option (d) is false as a single node can contain block of statements.


  1. Consider the NPDA < Q = {q0, q1, q2}, ∑ = {0, 1}, Γ = {0, 1,} ⊥ δ , q0, ⊥ , F = {q2} >, where (as per usual convention) Q is the set of states, ∑ is the input alphabet δ is the stack alphabet, δ is the state transition function, q0 is the initial state, ⊥ is the initial stack symbol, and F is the set of accepting states. The state transition is as follows:

    Which one of the following sequences must follow the string 101100 so that the overall string is accepted by the automata?









  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    NA



  1. A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example, int a [10] [3];
    The grammars use D as the start symbol, and use six terminal symbols int; id []num.
    Grammar G1 Grammar G2
    D → int L; D → int L;
    L → id [E L → id E
    E → num] E → E[num]
    E → num] [E E → [num]

    Which of the grammars correctly generate the declaration mentioned above?









  1. View Hint View Answer Discuss in Forum

    Both G1 and G2 can correctly generate the declarations.

    Correct Option: A

    Both G1 and G2 can correctly generate the declarations.