1.

Given grammar G:S->aAS-> A| B| CA-> aAa| BB-> bB|bbC->aCaa|DD->baD|abD|aaEliminate e and unit productions and state the number of variables left?(a) 5(b) 4(c) 3(d) 2The question was asked during an internship interview.I need to ask this question from Eliminating Unit Productions in division Properties of Context Free Languages of Automata Theory

Answer»

Right choice is (a) 5

Easy explanation: The REDUCED PRODUCTION:

 S->aAa| BB|bb aCaa| baD| ABD| AA, A->aAa| bB| bb, B->bB| bb, C->aCaa| baD| abD| aa, D-> baD| abD| aa



Discussion

No Comment Found

Related InterviewSolutions