GATE | GATE-CS-2004 | Question 90

Assume that the operators +, -, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix expression a + b × c – d ^ e ^ f is
(A) abc × + def ^ ^ –
(B) abc × + de ^ f ^ –
(C) ab + c × d – e ^ f ^
(D) – + a × bc ^ ^ def


Answer: (A)

Explanation: ^ is right assosciative.

parul_10

See http://geeksquiz.com/stack-set-2-infix-to-postfix/

This solution is contributed by parul Sharma.


Quiz of this Question



Recommended Posts:



1 Average Difficulty : 1/5.0
Based on 1 vote(s)