Context Free Languages questions

Q42

GATE CS 2016 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the following context-free grammars:
G1:S→aS∣B,B→b∣bBG_1: S \to aS|B, B \to b|bB
G2:S→aA∣bB,A→aA∣B∣ϵ,B→bB∣ϵG_2: S \to aA|bB, A \to aA|B|\epsilon, B \to bB|\epsilon
Which one of the following pairs of languages is generated by G1G_1 and G2G_2, respectively?
Show answer without attempting

Answer: D

Q43

GATE CS 2016 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the transition diagram of a PDA given below with input alphabet Σ={a,b}\Sigma = \{a,b\} and stack alphabet Γ={X,Z}\Gamma = \{X,Z\}. ZZ is the initial stack symbol. Let LL denote the language accepted by the PDA.

Which one of the following is TRUE?
Question figure
Show answer without attempting

Answer: D

Q18

GATE CS 2016 CS-2Context Free LanguagesMCQ1 mark−1/3 if wrong
Consider the following types of languages: L1L_1 : Regular, L2L_2 : Context-free, L3L_3 : Recursive, L4L_4 : Recursively enumerable. Which of the following is/are TRUE?

I. L3‾∪L4\overline{L_3} \cup L_4 is recursively enumerable
II. L2‾∪L3\overline{L_2} \cup L_3 is recursive
III. L1∗∩L2L_1^* \cap L_2 is context-free
IV. L1∪L2‾L_1 \cup \overline{L_2} is context-free
Show answer without attempting

Answer: D

Q43

GATE CS 2016 CS-2Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the following languages:
L1={anbmcn+m:m,n≥1}L_1 = \{a^n b^m c^{n+m} : m,n \ge 1\}
L2={anbnc2n:n≥1}L_2 = \{a^n b^n c^{2n} : n \ge 1\}

Which one of the following is TRUE?
Show answer without attempting

Answer: B

Q46

GATE CS 2016 CS-2Context Free LanguagesMCQ2 marks−2/3 if wrong
A student wrote two context-free grammars G1\mathbf{G_1} and G2\mathbf{G_2} 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 DD as the start symbol, and use six terminal symbols int ; id [ ] num.
Grammar G1\mathbf{G_1}Grammar G2\mathbf{G_2}
D→int L;D \to \textbf{int}\, L;D→int L;D \to \textbf{int}\, L;
L→id [EL \to \textbf{id}\, [EL→id EL \to \textbf{id}\, E
E→num ]E \to \textbf{num}\, ]E→E[num]E \to E[\textbf{num}]
E→num ][EE \to \textbf{num}\, ][EE→[num]E \to [\textbf{num}]
Which of the grammars correctly generate the declaration mentioned above?
Show answer without attempting

Answer: A

0/50 correct0 marks

Related topics in Theory of Computation