InterviewSolution
Saved Bookmarks
| 1. |
Evaluate the following infix expression using algorithm and choose the correct answer. a+b*c-d/e^fwhere a=1, b=2, c=3, d=4, e=2, f=2.(a) 6(b) 8(c) 9(d) 7This interesting question is from Evaluation of an Infix Expression (Not Parenthesized) in portion Application of Stacks of Data Structures & Algorithms IThis question was addressed to me during an interview. |
|
Answer» CORRECT CHOICE is (a) 6 ^ has the HIGHEST order of PRECEDENCE. Hence, 2^2 is evaluated FIRST, and then, 2*3 and 4/4 are evaluated. Therefore, 1+6-1=6. |
|