Context Free Grammar: GATE CS Previous Year Questions

Context Free Grammar · Theory of Computation

33 questions · asked in 12 of 27 years (2000–2026)

MCQ 26 · MSQ 5 · NAT 21-mark 15 · 2-mark 18

2000Questions per year2026

Questions 26–30 of 33

Q26GATE 20061 markMCQ−0.33 if wrong
In the context-free grammar below, S is the start symbol, a and b are terminals, andϵ\epsilon denotes the empty string
S→aSa∣bSb∣a∣b∣ϵS \rightarrow aSa \mid bSb \mid a \mid b \mid \epsilon
Which of the following strings is NOT generated by the grammar?

Q27GATE 20061 markMCQ−0.33 if wrong
Consider the following statements about the context-free grammer
G={S→SS,S→ab,S→ba,S→ε}G=\{S\rightarrow SS, S\rightarrow ab, S\rightarrow ba, S\rightarrow \varepsilon \}
1. G is ambiguous
2. G produces all strings with equal number of a's and b's
3. G can be accepted by a deterministic PDA.
Which combination below expresses all the true statements about G?

Q28GATE 20041 markMCQ−0.33 if wrong
Which one of the following statements is FALSE?

Q29GATE 20041 markMCQ−0.33 if wrong
Which of the following grammar rules violate the requirements of an operator grammar? P, Q, R are nonterminals, and r,s,t are terminals.
(i)P→QR(i)P\rightarrow QR
(ii)P→QsR(ii)P\rightarrow QsR
(iii)P→ε(iii)P\rightarrow \varepsilon
(iv)P→QtRr(iv)P\rightarrow QtRr

Q30GATE 20031 markMCQ−0.33 if wrong
Consider the grammar shown below.
S →\rightarrow C C
C →\rightarrow cC | d
The grammar is

Keep practising

Topics in Theory of Computation

All CS topics ›