CBSE NET JUNE 2014 PAPER III
The reverse polish notation equivalent to the infix expression
((A + B) * C + D) / (E + F + G) is
(A) A B + C * D + E F + G + /
(B) A B + C D * + E F + G + /
(C) A B + C * D + E F G + +/
(D) A B + C * D + E + F G + /
Ans:-A
Explanation:-
Always the expression given within parenthesis is converted first. Since there are 2 expressions with the parenthesis, I am going with the expression (E + F + G) first, the order does not matter.
In the expression (E + F + G), there are 3 operands E,F and G and two operators, both being +. Since both the operators are the same, the expression is going to be evaluated from left to right. So E + F is considered first and converted into postfix form which is EF+. So, the expression becomes,
( ( A + B ) * C + D) / ([E F +] + G)
Any expression converted into postfix form is going to be written in square brackets.
( ( A + B ) * C + D) / [ E F + G + ]
. Here EF+ is one operand, G is another operand and + is the operator.
The next expression to be converted into postfix is ( A + B).
( [ A B + ] * C + D) / [ E F + G + ]
Now, the expression which is enclosed in parenthesis is evaluated and so, we get
( [ [ A B + ] C * ] + D) / [ E F + G + ]
[ A B + C * D + ] / [ E F + G + ]
[ A B + C * D + ] [ E F + G + ] /
Answer is, final postfix expression A B + C * D + E F + G + /.