Any string of terminals that can be generated by the following context free grammar (where S is start nonterminal symbol)
S → XY
X → 0X | 1X | 0
Y → Y0 | Y1 | 0
Solution
The correct answer is option 4.
Explanation :
Given grammar is :
S → XY
X → 0X | 1X | 0
Y → Y0 | Y1 | 0
Now, we are trying to generate the minimum string generated from the grammar :

We have given options :
- has at least one 1 - not possible.
- should end with 0 - possible
- has no consecutive 0’s or 1’s - not possible
- has at least two 0’s - possible
[ by option elimination option 1 and 3 are not possible ]
Now, we can generate the string 001 from the grammar .
Therefore ,we can say the grammar not always generate strings that ends with 0,it may ends with 1 also.
Thus, the grammar generates the strings that has at least two 0's.