Which of the following strings will correctly match the Grammar G represented by production rules given?
S → A | B
A → aAb | c
B → bBd | e
- (A)
accbb
- (B)
aacbb
- (C)
abaed
- (D)
aaebb
Which of the following strings will correctly match the Grammar G represented by production rules given?
S → A | B
A → aAb | c
B → bBd | e
accbb
aacbb
abaed
aaebb
ANSWER
The string , option (b), is generated by the grammar.
Official answer: BSource: ISRO's final answer key of 15 May 2026
Expand : each use of adds one on the left and one on the right, and ends the derivation. So .
Expand : each use of adds one on the left and one on the right, and ends it. So .
Since , a string is generated only if it has the form or .
(a) has two 's. Every string of has exactly one or exactly one , so it is not generated.
(b) is of the form with . Derivation: . It is generated.
(c) has no , so it is not of the form . It is not of the form either, because it starts with . It is not generated.
(d) mixes 's with . never produces and never produces , so it is not generated.
Only option (b) is derivable from .
KEY IDEA
Work out the language of each non-terminal separately. gives and gives . Then check each string against the two forms.
WATCH OUT FOR
Treating the symbols as freely mixable, for example accepting or . In this grammar 's pair only with and 's, and only comes with 's and 's. Each string also has exactly one or one .
From the ISRO CS 2025 paper. Every question of this paper · The full paper (PDF, ISRO) · All 6 ISRO CFG & PDA questions, with notes