FORMAL LANGUAGE & AUTOMATA THEORY

100406
Back to FORMAL LANGUAGE & AUTOMATA THEORY

Module 2: Context-Free Languages (CFL) and PDA

  1. Q1a. 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 above20232m

    Module 2: Context-Free Languages (CFL) and PDA

    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 →
  2. Q1d. Context-free languages are NOT closed under (i) Union (ii) Concatenation (iii) Intersection (iv) Kleene star20252m

    Module 2: Context-Free Languages (CFL) and PDA

    Context-free languages are NOT closed under

    (i) Union
    (ii) Concatenation
    (iii) Intersection
    (iv) Kleene star

    View this question on its own page →
  3. Q1e. If L_1 and L_2 are CFLs, L_1 - L_2 is ____ context-free. (i) always (ii) sometimes (iii) never (iv) None of the above20212m

    Module 2: Context-Free Languages (CFL) and PDA

    If L1L_1 and L2L_2 are CFLs, L1L2L_1 - L_2 is ____ context-free.

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

    View this question on its own page →
  4. Q1f. A given grammar is called ambiguous if: (i) two or more productions have the same non-terminal on LHS (ii) a derivation tree has more than one associated sentence (iii) there exists a sentence with more than one derivation tree (iv) brackets are not present in the grammar20232m

    Module 2: Context-Free Languages (CFL) and PDA

    A given grammar is called ambiguous if:

    (i) two or more productions have the same non-terminal on LHS
    (ii) a derivation tree has more than one associated sentence
    (iii) there exists a sentence with more than one derivation tree
    (iv) brackets are not present in the grammar

    View this question on its own page →
  5. Q1f. Which of the following does not have left recursion? (i) Chomsky Normal Form (ii) Greibach Normal Form (iii) Backus–Naur Form (iv) All of the above20212m

    Module 2: Context-Free Languages (CFL) and PDA

    Which of the following does not have left recursion?

    (i) Chomsky Normal Form
    (ii) Greibach Normal Form
    (iii) Backus–Naur Form
    (iv) All of the above

    View this question on its own page →
  6. Q1g. Which one of the following statements is true? (i) The intersection of two CFLs is context-free (ii) Every CFL can be accepted by a DPDA (iii) The union of two CFLs is context-free (iv) The complement of a CFL is context-free20232m

    Module 2: Context-Free Languages (CFL) and PDA

    Which one of the following statements is true?

    (i) The intersection of two CFLs is context-free
    (ii) Every CFL can be accepted by a DPDA
    (iii) The union of two CFLs is context-free
    (iv) The complement of a CFL is context-free

    View this question on its own page →
  7. 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 (CFL) and PDA

    ____ 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 →
  8. Q1i. Which of the following CFLs is deterministic? (i) {a^n b^n} (ii) Arithmetic expressions (iii) Palindromes (iv) {ww^R}20252m

    Module 2: Context-Free Languages (CFL) and PDA

    Which of the following CFLs is deterministic?

    (i) {anbna^n b^n}
    (ii) Arithmetic expressions
    (iii) Palindromes
    (iv) {wwRww^R}

    View this question on its own page →
  9. Q1j. Which of the following is a PDA? (i) Finite automaton with a stack (ii) Turing machine with a stack (iii) Finite automaton with a queue (iv) Turing machine with a queue20242m

    Module 2: Context-Free Languages (CFL) and PDA

    Which of the following is a PDA?

    (i) Finite automaton with a stack
    (ii) Turing machine with a stack
    (iii) Finite automaton with a queue
    (iv) Turing machine with a queue

    View this question on its own page →
  10. Q2a. Given the grammar G = (\{S\}, \{a, b\}, P, S) P: S \rightarrow aSb | ab Derive the string aabb using leftmost derivation, rightmost derivation and also draw the parse tree.20257m

    Module 2: Context-Free Languages (CFL) and PDA

    Given the grammar
    G=({S},{a,b},P,S)G = (\{S\}, \{a, b\}, P, S)
    P:SaSbabP: S \rightarrow aSb | ab

    Derive the string aabb using leftmost derivation, rightmost derivation and also draw the parse tree.

    View this question on its own page →
  11. Q2b. State the pumping lemma for context-free languages.20237m

    Module 2: Context-Free Languages (CFL) and PDA

    State the pumping lemma for context-free languages.

    View this question on its own page →
  12. Q3a. Prove that if L is accepted by a PDA, then L can be generated by a CFG.20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Prove that if LL is accepted by a PDA, then LL can be generated by a CFG.

    View this question on its own page →
  13. Q3a. Design a context-free grammar (CFG) that generates all palindromes over the alphabet {0, 1}. The grammar should generate both even-length palindromes (e.g., 0110) and odd-length palindromes (e.g., 010).20257m

    Module 2: Context-Free Languages (CFL) and PDA

    Design a context-free grammar (CFG) that generates all palindromes over the alphabet {0, 1}. The grammar should generate both even-length palindromes (e.g., 0110) and odd-length palindromes (e.g., 010).

    View this question on its own page →
  14. Q3a. Design a PDA (empty stack and final state both) for L = \{ WW^r \mid W \in \{a,b\}^* \}.20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Design a PDA (empty stack and final state both) for L={WWrW{a,b}}L = \{ WW^r \mid W \in \{a,b\}^* \}.

    View this question on its own page →
  15. Q3b. Eliminate \varepsilon, unit, and useless productions from the grammar: A → bA | Bba | aa B → aba | b | D C → CA | AC | B D → a | \varepsilon20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Eliminate ε\varepsilon, unit, and useless productions from the grammar:

    A → bA | Bba | aa
    B → aba | b | D
    C → CA | AC | B
    D → a | ε\varepsilon

    View this question on its own page →
  16. Q3b. Design an NPDA (empty stack and final state acceptance) for: L = \{\text{palindromes over } \{a,b\}\}20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Design an NPDA (empty stack and final state acceptance) for:

    L={palindromes over {a,b}} L = \{\text{palindromes over } \{a,b\}\}

    View this question on its own page →
  17. Q3b. Construct a PDA that accepts: L = \{ u a w b : u,w \in \{a,b\}^*,\; |u| = |w| \}20217m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct a PDA that accepts:

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

    View this question on its own page →
  18. Q4a. Define Chomsky Normal Form. Convert the CFG: S → aSb | ab | Aa A → aab to CNF.20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Define Chomsky Normal Form. Convert the CFG:

    S → aSb | ab | Aa
    A → aab

    to CNF.

    View this question on its own page →
  19. Q4b. Show whether the given grammar is ambiguous: S \to a \mid abSb \mid aAb \\ A \to bS \mid aAAb20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Show whether the given grammar is ambiguous:

    SaabSbaAbAbSaAAb S \to a \mid abSb \mid aAb \\ A \to bS \mid aAAb

    View this question on its own page →
  20. Q5a. Using the CYK algorithm, determine whether baaba is in L(G) for the grammar: `` S → AB | BC A → BA | a B → CC | b C → AB | a ``202114m

    Module 2: Context-Free Languages (CFL) and PDA

    Using the CYK algorithm, determine whether baaba is in L(G)L(G) for the grammar:

    S → AB | BC
    A → BA | a
    B → CC | b
    C → AB | a
    
    View this question on its own page →
  21. Q5a. Show that the following grammar is ambiguous: S \rightarrow SS | aSb | bSa | \epsilon20257m

    Module 2: Context-Free Languages (CFL) and PDA

    Show that the following grammar is ambiguous:
    SSSaSbbSaϵS \rightarrow SS | aSb | bSa | \epsilon

    View this question on its own page →
  22. Q5b. Write the difference between Pushdown Automata and Finite Automata.20247m

    Module 2: Context-Free Languages (CFL) and PDA

    Write the difference between Pushdown Automata and Finite Automata.

    View this question on its own page →
  23. Q5b. Suppose L is CFL and R is regular: (i) Is L - R always CFL? (ii) Is R - L always CFL?202114m

    Module 2: Context-Free Languages (CFL) and PDA

    Suppose LL is CFL and RR is regular:

    (i) Is LRL - R always CFL?
    (ii) Is RLR - L always CFL?

    View this question on its own page →
  24. Q6a. Construct a PDA for the language: L = \{ 0^m 1^n 0^k \mid k \ge 1, m \ge 1, m > n + 2 \}20247m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct a PDA for the language:

    L={0m1n0kk1,m1,m>n+2}L = \{ 0^m 1^n 0^k \mid k \ge 1, m \ge 1, m > n + 2 \}

    View this question on its own page →
  25. Q6a. Construct a CFG for: \{ 0^i 1^j 2^k \mid i + j \ge 2k \}20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct a CFG for:

    {0i1j2ki+j2k} \{ 0^i 1^j 2^k \mid i + j \ge 2k \}

    View this question on its own page →
  26. Q6b. Convert the CFG to GNF: S \to AB \mid BC \\ A \to aB \mid bA \mid a \\ B \to bB \mid cC \mid b \\ C \to c20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Convert the CFG to GNF:

    SABBCAaBbAaBbBcCbCc S \to AB \mid BC \\ A \to aB \mid bA \mid a \\ B \to bB \mid cC \mid b \\ C \to c

    View this question on its own page →
  27. Q6b. Let G be a CFG in CNF with b variables. Show that if G derives any string using at least 2^b steps, then L(G) is infinite.20217m

    Module 2: Context-Free Languages (CFL) and PDA

    Let GG be a CFG in CNF with bb variables. Show that if GG derives any string using at least 2b2^b steps, then L(G)L(G) is infinite.

    View this question on its own page →
  28. Q7a. Construct a PDA for the grammar: S \to 0BB B \to 0S \mid 1S \mid 0 Test whether 0104 is accepted by this PDA.20247m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct a PDA for the grammar:

    S0BBS \to 0BB
    B0S1S0B \to 0S \mid 1S \mid 0

    Test whether 01040104 is accepted by this PDA.

    View this question on its own page →
  29. Q7a. Construct NPDA for the grammar: S \to \alpha ABB \mid \alpha AA \\ A \to \alpha BB \mid \alpha \\ B \to bBB \mid A20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct NPDA for the grammar:

    SαABBαAAAαBBαBbBBA S \to \alpha ABB \mid \alpha AA \\ A \to \alpha BB \mid \alpha \\ B \to bBB \mid A

    View this question on its own page →
  30. Q7b. Check whether the grammar is ambiguous: S \to a \mid abSb \mid aAb A \to bS \mid aAAb20247m

    Module 2: Context-Free Languages (CFL) and PDA

    Check whether the grammar is ambiguous:

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

    View this question on its own page →
  31. Q7b. Check whether the grammar: S \to aSa \mid bSb \mid a \mid b is ambiguous.20217m

    Module 2: Context-Free Languages (CFL) and PDA

    Check whether the grammar:

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

    is ambiguous.

    View this question on its own page →
  32. Q8a. Construct FOLLOW sets for the grammar: E \to T E' \\ E' \to +\,T\,E' \mid \varepsilon \\ T \to F T' \\ T' \to -\,F\,T' \mid \varepsilon \\ F \to (E) \mid id20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct FOLLOW sets for the grammar:

    ETEE+TEεTFTTFTεF(E)id E \to T E' \\ E' \to +\,T\,E' \mid \varepsilon \\ T \to F T' \\ T' \to -\,F\,T' \mid \varepsilon \\ F \to (E) \mid id

    View this question on its own page →
  33. Q8b. Given the grammar: S \to aB \mid ba \\ B \to b \mid bs \mid aBB For the string aaabbabbba find: 1. Leftmost derivation 2. Rightmost derivation 3. Parse tree20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Given the grammar:

    SaBbaBbbsaBB S \to aB \mid ba \\ B \to b \mid bs \mid aBB

    For the string aaabbabbbaaaabbabbba find:

    1. Leftmost derivation
    2. Rightmost derivation
    3. Parse tree
    View this question on its own page →
  34. Q8b. Given the regular expression r = (a+b)^* (i) Construct a context-free grammar that generates the language described by r. (ii) Explain why the grammar correctly represents the given regular expression.20257m

    Module 2: Context-Free Languages (CFL) and PDA

    Given the regular expression r=(a+b)r = (a+b)^*

    (i) Construct a context-free grammar that generates the language described by rr.
    (ii) Explain why the grammar correctly represents the given regular expression.

    View this question on its own page →
  35. Q8b. Construct a PDA accepting: L = \{ a^{2n}bc : n \ge 0 \}20217m

    Module 2: Context-Free Languages (CFL) and PDA

    Construct a PDA accepting:

    L={a2nbc:n0} L = \{ a^{2n}bc : n \ge 0 \}

    View this question on its own page →
  36. Q9b. Write a short note on Chomsky Normal Form.20213.5m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Chomsky Normal Form.

    View this question on its own page →
  37. Q9b. Write a short note on Deterministic vs Nondeterministic PDA.20254.66m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Deterministic vs Nondeterministic PDA.

    View this question on its own page →
  38. Q9b(i). Write a short note on Deterministic PDA vs. Non-deterministic PDA.20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Deterministic PDA vs. Non-deterministic PDA.

    View this question on its own page →
  39. Q9b(ii). Write a short note on Chomsky Normal Form (CNF).20227m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Chomsky Normal Form (CNF).

    View this question on its own page →
  40. Q9d. Write short notes on: Pumping lemma for CFL.20237m

    Module 2: Context-Free Languages (CFL) and PDA

    Write short notes on: Pumping lemma for CFL.

    View this question on its own page →
  41. Q9d. Write a short note on the Pumping Lemma for CFL.20213.5m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on the Pumping Lemma for CFL.

    View this question on its own page →
  42. Q9d. Write a short note on Greibach Normal Form (GNF).20254.66m

    Module 2: Context-Free Languages (CFL) and PDA

    Write a short note on Greibach Normal Form (GNF).

    View this question on its own page →