Formal Language & Automata Theory
105503Module 2: Context-free languages and pushdown automata
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
View this question on its own page →The language is
(i) regular
(ii) context-free but not regular
(iii) Context-sensitive but not context free
(iv) type-0 but not context sensitiveQ1b. 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
View this question on its own page →Which of the following versions of Unix came up with YACC first?
(i) V3
(ii) V5
(iii) CB UNIX
(iv) UNIX-RTQ1b. 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
View this question on its own page →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 machineQ1c. 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
View this question on its own page →A pushdown automata can be represented as .
(i) True
(ii) FalseQ1c. 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
View this question on its own page →The language is
(i) regular
(ii) context-free but not regular
(iii) context-sensitive but not context-free
(iv) type-0 but not context-sensitiveQ1d. 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
View this question on its own page →Consider the following languages:
GATE[2005]
where is a special symbol,Which one of the following is true?
(i) is a deterministic CFL
(ii) is a deterministic CFL
(iii) is a CFL, but not a deterministic CFL
(iv) is a deterministic CFLQ1d. 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
View this question on its own page →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 aboveQ1d. 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
View this question on its own page →If and are context free languages, is ___________ context-free.
(i) always
(ii) sometimes
(iii) never
(iv) None of theseQ1e. 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
View this question on its own page →Consider the following statements about the context-free grammar:
(1)
(2) is ambiguous
(3) produces all strings with equal number of 's and 'scan be accepted by a deterministic PDA. Which combination below expresses all the true statements about ?
(i) 1 only
(ii) 1 and 3
(iii) 2 and 3
(iv) 1, 2 and 3Q1e. 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
View this question on its own page →If L1 and L2 are context-free languages, L1-L2 is ____ context-free.
(i) always
(ii) sometimes
(iii) never
(iv) None of the aboveQ1e. ___________ 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
View this question on its own page →___________ is the acyclic graphical representation of a grammar
(i) Binary tree
(ii) Octtree
(iii) Parse tree
(iv) None of the aboveQ1e. 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
View this question on its own page →Context-Free Grammars are equivalent to
(i) Finite Automata
(ii) Turing Machines
(iii) Linear Bounded Automata
(iv) Pushdown AutomataQ1f. 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
View this question on its own page →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 aboveQ1f. 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
View this question on its own page →Pumping Lemma for CFLs is used to prove a language is
(i) Not Context-Free
(ii) Regular
(iii) Decidable
(iv) Turing recognizableQ1f. 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
View this question on its own page →Consider the grammar whose SLR parser has states and LALR parser has states. What is the relation between and ?
(i)
(ii)
(iii)
(iv) None of the aboveQ1h. \_\_\_\_ 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
View this question on its own page →____ is the acyclic graphical representation of a grammar.
(i) Binary tree
(ii) Octtree
(iii) Parse tree
(iv) None of the aboveQ1i. 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
View this question on its own page →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 aboveQ2a. Write the context-free grammar to create palindrome over \{a, b\}.20207m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write the context-free grammar to create palindrome over .
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
View this question on its own page →Design a push-down automata for accepting the string for the language by the empty stack as well as final state.
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
View this question on its own page →Design ANPDA for accepting the string by the empty stack and by final state.
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
View this question on its own page →Construct a push-down automata that accepts the following language:
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
View this question on its own page →Begin with the grammar:
(i) Eliminate -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.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
View this question on its own page →Explain how ambiguity arises in the grammar . Remove the ambiguity by rewriting the grammar.
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
View this question on its own page →Design a pushdown automata to accept the following language by empty stack: .
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
View this question on its own page →Consider the grammar:
Use the CYK algorithm to determine whether the given string "baaba" is in or not.
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
View this question on its own page →Prove that the language is not context-free language.
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
View this question on its own page →Show given grammar over alphabet verify whether it is ambiguous or unambiguous:
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
View this question on its own page →Suppose is context free and is regular, justify your answer with the help of example:
(i) Is necessarily context free?
(ii) Is necessarily context free?Q5b. Define deterministic pushdown automata. Explain with an example.20227m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Define deterministic pushdown automata. Explain with an example.
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
View this question on its own page →Using Pumping Lemma for CFLs, prove that is not context-free.
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
View this question on its own page →Consider the following language:
Write a context-free grammar to generate and write shortest string in .
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
View this question on its own page →Prove that if is generated by a CFG, then is accepted by a non-deterministic PDA by empty stack.
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
View this question on its own page →Convert the following context-free grammar into GNF:
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
View this question on its own page →Design a pushdown automaton for the following context-free grammar:
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
View this question on its own page →Let be a context-free grammar in Chomsky normal form that contains variable. Show that if generates some string using a derivation with at least steps, then is infinite.
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
View this question on its own page →Construct a push-down automata that accepts the following language:
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
View this question on its own page →Using the following grammar
use the CYK algorithm to determine whether the given string is in or not.
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
View this question on its own page →When a CFG is called ambiguous? Show that is ambiguous.
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
View this question on its own page →Show given grammar over alphabet , verify whether it is ambiguous or unambiguous:
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
View this question on its own page →Design a pushdown automata for accepting the string for the language by the empty stack as well as final state.
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
View this question on its own page →Construct a PDA that accepts the language by final state and empty stack.
Q9a. Write a short note on: Pushdown Automata20257m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write a short note on:
Pushdown Automata
Q9b. Write a short note on: Type 2 grammar (context free)20203.5m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write a short note on: Type 2 grammar (context free)
Q9b. Write a short note on: Chomsky normal form20213.5m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write a short note on: Chomsky normal form
Q9d. Write a short note on: Pumping lemma for CFL20203.5m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write a short note on: Pumping lemma for CFL
Q9d. Write a short note on: Closure properties of CFLs20257m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write a short note on:
Closure properties of CFLs
Q9i. Write short notes on: Pumping lemma for CFL20227m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write short notes on: Pumping lemma for CFL
Q9ii. Write short notes on: GNF20227m
Module 2: Context-free languages and pushdown automata
View this question on its own page →Write short notes on: GNF