Consider two binary operators ‘↑’ and ‘↓’ with the precedence of operator ↓ being lower than that of the operator ↑. Operator ↑ is right associative while operator ↓ is left associative. Which one of the following represents the parse tree for expression (7↓3↑4↑3↓2)?

Consider two binary operators ‘↑’ and ‘↓’ with the precedence of operator ↓ being lower than that of the operator ↑. Operator ↑ is right associative while operator ↓ is left associative. Which one of the following represents the parse tree for expression (7↓3↑4↑3↓2)? Correct Answer <img alt="F1 Raju Shraddha 01.06.2021 D 12" src="//storage.googleapis.com/tb-img/production/21/06/F1_Raju_Shraddha_01.06.2021_D%2012.png" style="width: 127px; height: 261px;">

The correct answer is Option 2.

Key Points

Operator Precedence Associative 
 ↑ High Right associative
.↓ Low Left associative

 

Option 1: FALSE

7↓3↑4↑3↓2

(((7↓3)↑4)↑3)↓2)     // order of execution

Since ↑ is left-associative and therefore it is not correct

Related Questions