Open In App

GATE | GATE-CS-2005 | Question 59

Last Updated : 15 Sep, 2021
Like Article
Like
Save
Share
Report

Consider the grammar

E → E + n | E × n | n 

For a sentence n + n × n, the handles in the right-sentential form of the reduction are
(A) n, E + n and E + n × n
(B) n, E + n and E + E × n
(C) n, n + n and n + n × n
(D) n, E + n and E × n


Answer: (D)

Explanation:

E → E * n       {Applying E → E * n } 
  → E + n * n   {Applying E → E + n } 
  → n + n * n   {Applying E → n } 

Hence, the handles in right sentential form is n, E + n and E × n.



Quiz of this Question


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads