Formal Language & Automata Theory

105503
Back to Formal Language & Automata Theory

Module 2: Context-free languages and pushdown automata

  1. Q1a. The language \{ a^m b^n c^{m+n} / m, n \ge 1 \} is (i) regular (ii) context-free but not regular (iii) Context-sensitive but not context free (iv) type-0 but not context sensitive20222m

    Module 2: Context-free languages and pushdown automata

    The language {ambncm+n/m,n1}\{ a^m b^n c^{m+n} / m, n \ge 1 \} is
    (i) regular
    (ii) context-free but not regular
    (iii) Context-sensitive but not context free
    (iv) type-0 but not context sensitive

    View this question on its own page →
  2. Q1b. Which of the following versions of Unix came up with YACC first? (i) V3 (ii) V5 (iii) CB UNIX (iv) UNIX-RT20202m

    Module 2: Context-free languages and pushdown automata

    Which of the following versions of Unix came up with YACC first?

    (i) V3
    (ii) V5
    (iii) CB UNIX
    (iv) UNIX-RT

    View this question on its own page →
  3. Q1b. Which of the following pairs have DIFFERENT expressive powers? (i) Deterministic finite automata (DFA) and non-deterministic finite automata (NDFA) (ii) Deterministic push-down automata (DPDA) and non-deterministic push-down automata (NDPDA) (iii) Deterministic single-tape Turing machine and non-deterministic single-tape Turing machine (iv) Single-tape Turing machine and multi-tape Turing machine20222m

    Module 2: Context-free languages and pushdown automata

    Which of the following pairs have DIFFERENT expressive powers?
    (i) Deterministic finite automata (DFA) and non-deterministic finite automata (NDFA)
    (ii) Deterministic push-down automata (DPDA) and non-deterministic push-down automata (NDPDA)
    (iii) Deterministic single-tape Turing machine and non-deterministic single-tape Turing machine
    (iv) Single-tape Turing machine and multi-tape Turing machine

    View this question on its own page →
  4. Q1c. A pushdown automata can be represented as \text{PDA} = \epsilon\text{-NFA} + [\text{stack}]. (i) True (ii) False20202m

    Module 2: Context-free languages and pushdown automata

    A pushdown automata can be represented as PDA=ϵ-NFA+[stack]\text{PDA} = \epsilon\text{-NFA} + [\text{stack}].

    (i) True
    (ii) False

    View this question on its own page →
  5. Q1c. The language \{a^mb^nc^{m+n} \mid m, n \ge 1\} is (i) regular (ii) context-free but not regular (iii) context-sensitive but not context-free (iv) type-0 but not context-sensitive20212m

    Module 2: Context-free languages and pushdown automata

    The language {ambncm+nm,n1}\{a^mb^nc^{m+n} \mid m, n \ge 1\} is

    (i) regular
    (ii) context-free but not regular
    (iii) context-sensitive but not context-free
    (iv) type-0 but not context-sensitive

    View this question on its own page →
  6. Q1d. Consider the following languages: GATE[2005] L_1 = \{ww^R \mid w \in \{0, 1\}^*\} L_2 = \{w\#w^R \mid w \in \{0, 1\}^*\} where \# is a special symbol, L_3 = \{ww \mid w \in \{0, 1\}^*\} Which one of the following is true? (i) L_1 is a deterministic CFL (ii) L_2 is a deterministic CFL (iii) L_3 is a CFL, but not a deterministic CFL (iv) L_3 is a deterministic CFL20192m

    Module 2: Context-free languages and pushdown automata

    Consider the following languages:
    GATE[2005]
    L1={wwRw{0,1}}L_1 = \{ww^R \mid w \in \{0, 1\}^*\}
    L2={w#wRw{0,1}}L_2 = \{w\#w^R \mid w \in \{0, 1\}^*\}
    where #\# is a special symbol,
    L3={www{0,1}}L_3 = \{ww \mid w \in \{0, 1\}^*\}

    Which one of the following is true?
    (i) L1L_1 is a deterministic CFL
    (ii) L2L_2 is a deterministic CFL
    (iii) L3L_3 is a CFL, but not a deterministic CFL
    (iv) L3L_3 is a deterministic CFL

    View this question on its own page →
  7. Q1d. A language accepted by deterministic pushdown automata is closed under which of the following? (i) Complement (ii) Union (iii) Both (i) and (ii) (iv) None of the above20202m

    Module 2: Context-free languages and pushdown automata

    A language accepted by deterministic pushdown automata is closed under which of the following?

    (i) Complement
    (ii) Union
    (iii) Both (i) and (ii)
    (iv) None of the above

    View this question on its own page →
  8. Q1d. If L1 and L2 are context free languages, L1 - L2 is ___________ context-free. (i) always (ii) sometimes (iii) never (iv) None of these20222m

    Module 2: Context-free languages and pushdown automata

    If L1L1 and L2L2 are context free languages, L1L2L1 - L2 is ___________ context-free.
    (i) always
    (ii) sometimes
    (iii) never
    (iv) None of these

    View this question on its own page →
  9. Q1e. Consider the following statements about the context-free grammar: (1) G = \{S \to SS, S \to ab, S \to ba, S \to \epsilon\} (2) G is ambiguous (3) G produces all strings with equal number of a's and b's G can be accepted by a deterministic PDA. Which combination below expresses all the true statements about G? (i) 1 only (ii) 1 and 3 (iii) 2 and 3 (iv) 1, 2 and 320192m

    Module 2: Context-free languages and pushdown automata

    Consider the following statements about the context-free grammar:
    (1) G={SSS,Sab,Sba,Sϵ}G = \{S \to SS, S \to ab, S \to ba, S \to \epsilon\}
    (2) GG is ambiguous
    (3) GG produces all strings with equal number of aa's and bb's

    GG can be accepted by a deterministic PDA. Which combination below expresses all the true statements about GG?
    (i) 1 only
    (ii) 1 and 3
    (iii) 2 and 3
    (iv) 1, 2 and 3

    View this question on its own page →
  10. Q1e. If L1 and L2 are context-free languages, L1-L2 is \_\_\_\_ context-free. (i) always (ii) sometimes (iii) never (iv) None of the above20212m

    Module 2: Context-free languages and pushdown automata

    If L1 and L2 are context-free languages, L1-L2 is ____ context-free.

    (i) always
    (ii) sometimes
    (iii) never
    (iv) None of the above

    View this question on its own page →
  11. Q1e. ___________ is the acyclic graphical representation of a grammar (i) Binary tree (ii) Octtree (iii) Parse tree (iv) None of the above20222m

    Module 2: Context-free languages and pushdown automata

    ___________ is the acyclic graphical representation of a grammar
    (i) Binary tree
    (ii) Octtree
    (iii) Parse tree
    (iv) None of the above

    View this question on its own page →
  12. Q1e. Context-Free Grammars are equivalent to (i) Finite Automata (ii) Turing Machines (iii) Linear Bounded Automata (iv) Pushdown Automata20252m

    Module 2: Context-free languages and pushdown automata

    Context-Free Grammars are equivalent to

    (i) Finite Automata
    (ii) Turing Machines
    (iii) Linear Bounded Automata
    (iv) Pushdown Automata

    View this question on its own page →
  13. Q1f. Which of the following does not have left recursions? (i) Chomsky normal form (ii) Greibach normal form (iii) Backus-Naur form (iv) All of the above20212m

    Module 2: Context-free languages and pushdown automata

    Which of the following does not have left recursions?

    (i) Chomsky normal form
    (ii) Greibach normal form
    (iii) Backus-Naur form
    (iv) All of the above

    View this question on its own page →
  14. Q1f. Pumping Lemma for CFLs is used to prove a language is (i) Not Context-Free (ii) Regular (iii) Decidable (iv) Turing recognizable20252m

    Module 2: Context-free languages and pushdown automata

    Pumping Lemma for CFLs is used to prove a language is

    (i) Not Context-Free
    (ii) Regular
    (iii) Decidable
    (iv) Turing recognizable

    View this question on its own page →
  15. Q1f. Consider the grammar G whose SLR parser has n_1 states and LALR parser has n_2 states. What is the relation between n_1 and n_2? (i) n_1 = n_2 (ii) n_1 < n_2 (iii) n_1 > n_2 (iv) None of the above20192m

    Module 2: Context-free languages and pushdown automata

    Consider the grammar GG whose SLR parser has n1n_1 states and LALR parser has n2n_2 states. What is the relation between n1n_1 and n2n_2?

    (i) n1=n2n_1 = n_2
    (ii) n1<n2n_1 < n_2
    (iii) n1>n2n_1 > n_2
    (iv) None of the above

    View this question on its own page →
  16. Q1h. \_\_\_\_ is the acyclic graphical representation of a grammar. (i) Binary tree (ii) Octtree (iii) Parse tree (iv) None of the above20212m

    Module 2: Context-free languages and pushdown automata

    ____ is the acyclic graphical representation of a grammar.

    (i) Binary tree
    (ii) Octtree
    (iii) Parse tree
    (iv) None of the above

    View this question on its own page →
  17. Q1i. A ___________ is context free grammar with atmost one non-terminal in the right handside of the production. (i) linear grammar (ii) linear bounded grammar (iii) regular grammar (iv) None of the above20222m

    Module 2: Context-free languages and pushdown automata

    A ___________ is context free grammar with atmost one non-terminal in the right handside of the production.
    (i) linear grammar
    (ii) linear bounded grammar
    (iii) regular grammar
    (iv) None of the above

    View this question on its own page →
  18. Q2a. Write the context-free grammar to create palindrome over \{a, b\}.20207m

    Module 2: Context-free languages and pushdown automata

    Write the context-free grammar to create palindrome over {a,b}\{a, b\}.

    View this question on its own page →
  19. Q3b. Design a push-down automata for accepting the string for the language L = \{WW^R \mid W \in \{a, b\}^*\} by the empty stack as well as final state.20197m

    Module 2: Context-free languages and pushdown automata

    Design a push-down automata for accepting the string for the language L={WWRW{a,b}}L = \{WW^R \mid W \in \{a, b\}^*\} by the empty stack as well as final state.

    View this question on its own page →
  20. Q3b. Design ANPDA for accepting the string L = \{\text{set of all palindrome over } \{a, b\}\} by the empty stack and by final state.20207m

    Module 2: Context-free languages and pushdown automata

    Design ANPDA for accepting the string L={set of all palindrome over {a,b}}L = \{\text{set of all palindrome over } \{a, b\}\} by the empty stack and by final state.

    View this question on its own page →
  21. Q3b. Construct a push-down automata that accepts the following language: L = \{uawb : u \text{ and } w \in \{a, b\}^* \text{ and } |u| = |w|\}20217m

    Module 2: Context-free languages and pushdown automata

    Construct a push-down automata that accepts the following language:

    L={uawb:u and w{a,b} and u=w}L = \{uawb : u \text{ and } w \in \{a, b\}^* \text{ and } |u| = |w|\}

    View this question on its own page →
  22. Q4. Begin with the grammar: S \to ASB / \epsilon A \to aAS / a B \to SbS / A / bb (i) Eliminate \epsilon-productions. (ii) Eliminate unit productions in the resulting grammar. (iii) Eliminate any useless symbol in the resulting grammar. (iv) Put the resulting grammar into CNF.202214m

    Module 2: Context-free languages and pushdown automata

    Begin with the grammar:
    SASB/ϵS \to ASB / \epsilon
    AaAS/aA \to aAS / a
    BSbS/A/bbB \to SbS / A / bb

    (i) Eliminate ϵ\epsilon-productions.
    (ii) Eliminate unit productions in the resulting grammar.
    (iii) Eliminate any useless symbol in the resulting grammar.
    (iv) Put the resulting grammar into CNF.

    View this question on its own page →
  23. Q5a. Explain how ambiguity arises in the grammar E \rightarrow E + E \mid E \times E \mid id \mid (E). Remove the ambiguity by rewriting the grammar.20257m

    Module 2: Context-free languages and pushdown automata

    Explain how ambiguity arises in the grammar EE+EE×Eid(E)E \rightarrow E + E \mid E \times E \mid id \mid (E). Remove the ambiguity by rewriting the grammar.

    View this question on its own page →
  24. Q5a. Design a pushdown automata to accept the following language by empty stack: \{ 0^n 1^n / n \ge 1 \}.20227m

    Module 2: Context-free languages and pushdown automata

    Design a pushdown automata to accept the following language by empty stack: {0n1n/n1}\{ 0^n 1^n / n \ge 1 \}.

    View this question on its own page →
  25. Q5a. Consider the grammar: S \to AB \mid BC A \to BA \mid a B \to CC \mid b C \to AB \mid a Use the CYK algorithm to determine whether the given string "baaba" is in L(G) or not.202114m

    Module 2: Context-free languages and pushdown automata

    Consider the grammar:

    SABBCS \to AB \mid BC
    ABAaA \to BA \mid a
    BCCbB \to CC \mid b
    CABaC \to AB \mid a

    Use the CYK algorithm to determine whether the given string "baaba" is in L(G)L(G) or not.

    View this question on its own page →
  26. Q5a. Prove that the language L = \{a^{i^2} \mid i \ge 1\} is not context-free language.20197m

    Module 2: Context-free languages and pushdown automata

    Prove that the language L={ai2i1}L = \{a^{i^2} \mid i \ge 1\} is not context-free language.

    View this question on its own page →
  27. Q5a. Show given grammar over alphabet \{a, b\} verify whether it is ambiguous or unambiguous: S \to a \mid abSb \mid aAb A \to bS \mid aAAb20207m

    Module 2: Context-free languages and pushdown automata

    Show given grammar over alphabet {a,b}\{a, b\} verify whether it is ambiguous or unambiguous:

    SaabSbaAbS \to a \mid abSb \mid aAb
    AbSaAAbA \to bS \mid aAAb

    View this question on its own page →
  28. Q5b. Suppose L is context free and R is regular, justify your answer with the help of example: (i) Is L-R necessarily context free? (ii) Is R-L necessarily context free?202114m

    Module 2: Context-free languages and pushdown automata

    Suppose LL is context free and RR is regular, justify your answer with the help of example:

    (i) Is LRL-R necessarily context free?
    (ii) Is RLR-L necessarily context free?

    View this question on its own page →
  29. Q5b. Define deterministic pushdown automata. Explain with an example.20227m

    Module 2: Context-free languages and pushdown automata

    Define deterministic pushdown automata. Explain with an example.

    View this question on its own page →
  30. Q5b. Using Pumping Lemma for CFLs, prove that L = \{a^{n}b^{n}c^{n} \mid n \ge 0\} is not context-free.20257m

    Module 2: Context-free languages and pushdown automata

    Using Pumping Lemma for CFLs, prove that L={anbncnn0}L = \{a^{n}b^{n}c^{n} \mid n \ge 0\} is not context-free.

    View this question on its own page →
  31. Q6a. Consider the following language: L = \{a^m b^{2n} c^{3n} d^p \mid p > m \text{ and } m, n \ge 1\} Write a context-free grammar to generate L and write shortest string in L.20197m

    Module 2: Context-free languages and pushdown automata

    Consider the following language:
    L={amb2nc3ndpp>m and m,n1}L = \{a^m b^{2n} c^{3n} d^p \mid p > m \text{ and } m, n \ge 1\}

    Write a context-free grammar to generate LL and write shortest string in LL.

    View this question on its own page →
  32. Q6a. Prove that if L is generated by a CFG, then L is accepted by a non-deterministic PDA by empty stack.20207m

    Module 2: Context-free languages and pushdown automata

    Prove that if LL is generated by a CFG, then LL is accepted by a non-deterministic PDA by empty stack.

    View this question on its own page →
  33. Q6b. Convert the following context-free grammar into GNF: S \to XY X \to YS \mid b Y \to SX \mid a20197m

    Module 2: Context-free languages and pushdown automata

    Convert the following context-free grammar into GNF:
    SXYS \to XY
    XYSbX \to YS \mid b
    YSXaY \to SX \mid a

    View this question on its own page →
  34. Q6b. Design a pushdown automaton for the following context-free grammar: S \to aB \mid bA A \to aS \mid bAA \mid a B \to bS \mid aBB \mid b20207m

    Module 2: Context-free languages and pushdown automata

    Design a pushdown automaton for the following context-free grammar:

    SaBbAS \to aB \mid bA
    AaSbAAaA \to aS \mid bAA \mid a
    BbSaBBbB \to bS \mid aBB \mid b

    View this question on its own page →
  35. Q6b. Let G be a context-free grammar in Chomsky normal form that contains b variable. Show that if G generates some string using a derivation with at least 2^b steps, then L(G) is infinite.20217m

    Module 2: Context-free languages and pushdown automata

    Let GG be a context-free grammar in Chomsky normal form that contains bb variable. Show that if GG generates some string using a derivation with at least 2b2^b steps, then L(G)L(G) is infinite.

    View this question on its own page →
  36. Q7a. Construct a push-down automata that accepts the following language: L = \{uawb \mid u \text{ and } w \in \{a, b\}^* \text{ and } |u| = |w|\}20197m

    Module 2: Context-free languages and pushdown automata

    Construct a push-down automata that accepts the following language:
    L={uawbu and w{a,b} and u=w}L = \{uawb \mid u \text{ and } w \in \{a, b\}^* \text{ and } |u| = |w|\}

    View this question on its own page →
  37. Q7b. Using the following grammar S \to AB \mid BC A \to BA \mid a B \to CC \mid b C \to AB \mid a use the CYK algorithm to determine whether the given string baaba is in L(G) or not.20197m

    Module 2: Context-free languages and pushdown automata

    Using the following grammar
    SABBCS \to AB \mid BC
    ABAaA \to BA \mid a
    BCCbB \to CC \mid b
    CABaC \to AB \mid a

    use the CYK algorithm to determine whether the given string baababaaba is in L(G)L(G) or not.

    View this question on its own page →
  38. Q7b. When a CFG is called ambiguous? Show that S \to as / aSbS / \epsilon is ambiguous.20227m

    Module 2: Context-free languages and pushdown automata

    When a CFG is called ambiguous? Show that Sas/aSbS/ϵS \to as / aSbS / \epsilon is ambiguous.

    View this question on its own page →
  39. Q7b. Show given grammar over alphabet \{a, b\}, verify whether it is ambiguous or unambiguous: S \to aSa \mid bSb \mid a \mid b \mid \epsilon20217m

    Module 2: Context-free languages and pushdown automata

    Show given grammar over alphabet {a,b}\{a, b\}, verify whether it is ambiguous or unambiguous:

    SaSabSbabϵS \to aSa \mid bSb \mid a \mid b \mid \epsilon

    View this question on its own page →
  40. Q8b. Design a pushdown automata for accepting the string for the language L = \{WW^R \mid W \in \{a, b\}^*\} by the empty stack as well as final state.20207m

    Module 2: Context-free languages and pushdown automata

    Design a pushdown automata for accepting the string for the language L={WWRW{a,b}}L = \{WW^R \mid W \in \{a, b\}^*\} by the empty stack as well as final state.

    View this question on its own page →
  41. Q8b. Construct a PDA that accepts the language L = \{a^{2n}bc \mid n \ge 0\} by final state and empty stack.20217m

    Module 2: Context-free languages and pushdown automata

    Construct a PDA that accepts the language L={a2nbcn0}L = \{a^{2n}bc \mid n \ge 0\} by final state and empty stack.

    View this question on its own page →
  42. Q9a. Write a short note on: Pushdown Automata20257m

    Module 2: Context-free languages and pushdown automata

    Write a short note on:

    Pushdown Automata

    View this question on its own page →
  43. Q9b. Write a short note on: Type 2 grammar (context free)20203.5m

    Module 2: Context-free languages and pushdown automata

    Write a short note on: Type 2 grammar (context free)

    View this question on its own page →
  44. Q9b. Write a short note on: Chomsky normal form20213.5m

    Module 2: Context-free languages and pushdown automata

    Write a short note on: Chomsky normal form

    View this question on its own page →
  45. Q9d. Write a short note on: Pumping lemma for CFL20203.5m

    Module 2: Context-free languages and pushdown automata

    Write a short note on: Pumping lemma for CFL

    View this question on its own page →
  46. Q9d. Write a short note on: Closure properties of CFLs20257m

    Module 2: Context-free languages and pushdown automata

    Write a short note on:

    Closure properties of CFLs

    View this question on its own page →
  47. Q9i. Write short notes on: Pumping lemma for CFL20227m

    Module 2: Context-free languages and pushdown automata

    Write short notes on: Pumping lemma for CFL

    View this question on its own page →
  48. Q9ii. Write short notes on: GNF20227m

    Module 2: Context-free languages and pushdown automata

    Write short notes on: GNF

    View this question on its own page →