Open In App

GATE | GATE CS 2018 | Question 43

Like Article
Like
Save
Share
Report

Consider the following parse tree for the expression a#b$c$d#e#f, involving two binary operators $ and #.

10

Which one of the following is correct for the given parse tree?

(A) $ has higher precedence and is left associative; # is right associative
(B) # has higher precedence and is left associative; $ is right associative
(C) $ has higher precedence and is left associative; # is left associative
(D) # has higher precedence and is right associative; $ is left associative


Answer: (A)

Explanation: Since $ will be evaluated first, so has higher precedence with left associativity. Whereas # is right associative. In d#e#f, e#f will be evaluated first (refer given parse tree).
Therefore, option (A) is Correct.



Quiz of this Question


Last Updated : 01 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads