Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

multiple choice: An appropriate grammar for the palindromes over the alphabet {a

ID: 3742840 • Letter: M

Question

multiple choice:

An appropriate grammar for the palindromes over the alphabet {a, b, c} is:

a) S aSa | bSb | cSc | a | b | c

b) S aSa | bSb | cSc | a | b | c |

c) S aSa | bSb | cSc |

d) S aSb | bSc | cSa | a | b | c |

Please explain with answer, thank you.

a) S aSa | bSb | cSc | a | b | c

b) S aSa | bSb | cSc | a | b | c |

c) S aSa | bSb | cSc |

d) S aSb | bSc | cSa | a | b | c |

Explanation / Answer

b) S aSa | bSb | cSc | a | b | c | S aSa | bSb | cSc This will generate palindrome strings over alphabet a, b and c S -> a | b | c This will leave a letter a or b or c in the middle S -> This will not leave any letter in middle, making it an even letter palindrome. So, answer is b.