Which of the following sentences can be generated by S -> aS | bA A -> d | cA
2011
Which of the following sentences can be generated by
S -> aS | bA
A -> d | cA- A.
bccdd
- B.
abbcca
- C.
abcabc
- D.
abcd
Attempted by 41 students.
Show answer & explanation
Correct answer: D
The production rules are S -> aS | bA and A -> d | cA. The non-terminal S generates any number of 'a's followed by a single 'b' and then transitions to A. The non-terminal A generates any number of 'c's followed by a single 'd'. Thus, the language consists of strings with zero or more 'a's, exactly one 'b', zero or more 'c's, and ending with exactly one 'd'.