Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)
Click on any option to know the CORRECT ANSWERS
How many stacks are required for applying evaluation of infix expression algorithm?
Question 1 Explanation:
Two stacks are required for evaluation of infix expression - one for operands and one for operators.
How many passes does the evaluation of infix expression algorithm makes through the input?
Question 2 Explanation:
Evaluation of infix expression algorithm is linear and makes only one pass through the input.
Identify the infix expression from the list of options given below.
Question 3 Explanation:
a/b+(c-d) is an infix expression since the operators are placed in between the operands.
Which of the following statement is incorrect with respect to evaluation of infix expression algorithm?
Operand is pushed on to the stack
If the precedence of operator is higher, pop two operands and evaluate
If the precedence of operator is lower, pop two operands and evaluate
The result is pushed on to the operand stack
Question 4 Explanation:
If the precedence of the operator is higher than the stack operator, then it is pushed on to the stack operator.
Evaluate the following statement using infix evaluation algorithm and choose the correct answer. 1+2*3-2
Question 5 Explanation:
According to precedence of operators, * is evaluated first. + and - have equal priorities. Hence, 1+6-2= 5.
There are 5 questions to complete.