GATE CS 2026 Set 1 | Question 52
Theory of Computation › Context Free Grammar · MSQ · 2 marks · Answer: B, D
- Question 52Theory of Computationmsq2 marksConsider the following context-free grammar .In the above grammar, is the start symbol, and are terminal symbols, and and are non-terminal symbols. Let be the language generated by the grammar . For a string , let be the number of ’s in and be the number of ’s in . Which of the following statements is/are true?
- A.There is a string such that
- B.For every string ,✓
- C.There is a string such that
- D.For every string ,✓
Answer: B, D
Solution
Answer: B, D Track (#a, #b) for each non-terminal. • with : equal a's and b's. • : adds a:3, b:2 plus a balanced , so . • : adds a:2, b:1 plus balanced s, so +1 more per step. Every has . • : the terminals "aba" and "bba" give a:3, b:3, so . So always: (B) true, (A) false. Ratio check: each block keeps : the block, a:3 ≤ 2·2, a:2 ≤ 2·1, and a:3 ≤ 2·3. Sums of such blocks keep the bound, so (D) is true and (C) false. - A.
More GATE PYQ on Context Free Grammar
All GATE CS Theory of Computation PYQ →Attempt GATE CS 2026 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →