Context Free Languages questions

Q10

GATE CS 2017 CS-1Context Free LanguagesMCQ1 mark−1/3 if wrong
Consider the following context-free grammar over the alphabet Σ={a,b,c}\Sigma = \{a, b, c\} with SS as the start symbol:

S→abScT∣abcTS \to abScT \mid abcT
T→bT∣bT \to bT \mid b

Which one of the following represents the language generated by the above grammar?
Show answer without attempting

Answer: B

Q17

GATE CS 2017 CS-1Context Free LanguagesMCQ1 mark−1/3 if wrong
Consider the following grammar:

P→xQRSQ→yz∣zR→w∣εS→y\begin{aligned} P & \to xQRS \\ Q & \to yz \mid z \\ R & \to w \mid \varepsilon \\ S & \to y \end{aligned}

What is FOLLOW(Q)\text{FOLLOW}(Q)?
Show answer without attempting

Answer: C

Q34

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
If GG is a grammar with productions

S→SaS∣aSb∣bSa∣SS∣εS \to SaS \mid aSb \mid bSa \mid SS \mid \varepsilon

where SS is the start variable, then which one of the following strings is not generated by GG?
Show answer without attempting

Answer: D

Q37

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the context-free grammars over the alphabet {a,b,c}\lbrace a, b, c \rbrace given below. SS and TT are non-terminals.

G1:S→aSb∣T,T→cT∣εG_1: S \to aSb \mid T, T \to cT \mid \varepsilon
G2:S→bSa∣T,T→cT∣εG_2: S \to bSa \mid T, T \to cT \mid \varepsilon

The language L(G1)∩L(G2)L(G_1) \cap L(G_2) is
Show answer without attempting

Answer: B

Q38

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \lbrace a, b, c \rbrace. Let L1={anbncm∣m,n≥0}L_1 = \lbrace a^n b^n c^m \mid m, n \ge 0 \rbrace and L2={ambncn∣m,n≥0}L_2 = \lbrace a^m b^n c^n \mid m, n \ge 0 \rbrace.

Which of the following are context-free languages?

I. L1∪L2L_1 \cup L_2
II. L1∩L2L_1 \cap L_2
Show answer without attempting

Answer: A

Q4

GATE CS 2017 CS-2Context Free LanguagesMCQ1 mark−1/3 if wrong
Let L1,L2L_1, L_2 be any two context-free languages and RR be any regular language. Then which of the following is/are CORRECT?

I. L1∪L2L_1 \cup L_2 is context-free.
II. L1‾\overline{L_1} is context-free.
III. L1−RL_1 - R is context-free.
IV. L1∩L2L_1 \cap L_2 is context-free.
Show answer without attempting

Answer: B

Q16

GATE CS 2017 CS-2Context Free LanguagesMCQ1 mark−1/3 if wrong
Identify the language generated by the following grammar, where SS is the start variable.

<br>S→XY<br>X→aX∣a<br>Y→aYb∣ϵ<br>\begin{aligned}<br>S &\rightarrow XY \\<br>X &\rightarrow aX \mid a \\<br>Y &\rightarrow aYb \mid \epsilon<br>\end{aligned}
Show answer without attempting

Answer: C

0/70 correct0 marks

Related topics in Theory of Computation