Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)
Click on any option to know the CORRECT ANSWERS
Evaluation of infix expression is done based on precedence of operators.
Question 6 Explanation:
During evaluation of infix expression, the operators with higher precedence are evaluated first, followed by operators with lower precedence.
Of the following choice s, which operator has the lowest precedence?
Question 7 Explanation:
The operator with the lowest precedence is #, preceded by +, / and then ^.
The system throws an error if parentheses are encountered in an infix expression evaluation algorithm.
Question 8 Explanation:
The algorithm holds good for infix expression with parentheses. The system does not throw error.
Evaluate the following and choose the correct answer.
a/b+c*d where a=4, b=2, c=2, d=1.
Question 9 Explanation:
* and / have higher priority. Hence, they are evaluated first. Then, + is evaluated. Hence, 2+2=4.
Evaluate the following statement using infix evaluation algorithm and choose the correct answer. 4*2+3-5/5
Question 10 Explanation:
4*2 and 5/5 are evaluated first and then, 8+3-1 is evaluated and the result is obtained as 10.
There are 10 questions to complete.