Q9: Context Free Grammar

Question #9: What does the following grammar represent?

CFG

Options:

  1. All strings which start with 0 and end with 1.
  2. All strings whose only first and last symbol is same.
  3. All strings that reads the same forward and backward.
  4. All strings of 0 and 1.

 

Solution:

First three rules are the basis and 4th and 5th rule can form any string by appending same symbol before and after the string. These strings are known as palindrome strings. Hence, the correct answer is option 3.