1.

What is the postfix expression of the given expression, (2*4-(5+7/3^4)-8)10?(a) 2 4 5 * 7 3 4 ^ / + 8 – – 10(b) 2 4 * ^ 5 7 3 4 / + 8 10 – –(c) 2 4 * 5 7 ^ 3 4 / + – 8 10 –(d) 2 4 * 5 7 3 4 ^ / + – 8 – 10The question was asked during an interview.This is a very interesting question from Trees topic in chapter Trees of Discrete Mathematics

Answer»

The correct answer is (d) 2 4 * 5 7 3 4 ^ / + – 8 – 10

For explanation: By SOLVING we can have,

(2*4-(5+7/3^4)-8)10

= (2*4-(5+7/34^)-8)10

= (2*4-(5+734^/)-8)10

= (2*4-(5734^/+)-8)10

= (2*45734^/+–8)10

= 2*45734^/+-8-10

= 24*5734^/+-8-10

So the output is: 2 4 * 5 7 3 4 ^ / + – 8 – 10.



Discussion

No Comment Found

Related InterviewSolutions