Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)

Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How many stacks are required for applying evaluation of infix expression algorithm?
 A one B two C three D four
Question 1 Explanation:
Two stacks are required for evaluation of infix expression - one for operands and one for operators.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How many passes does the evaluation of infix expression algorithm makes through the input?
 A One B Two C Three D Four
Question 2 Explanation:
Evaluation of infix expression algorithm is linear and makes only one pass through the input.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Identify the infix expression from the list of options given below.
 A a/b+(c-d) B abc*+d+ab+cd+*ce-f- C ab-c- D +ab
Question 3 Explanation:
a/b+(c-d) is an infix expression since the operators are placed in between the operands.

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following statement is incorrect with respect to evaluation of infix expression algorithm?
 A Operand is pushed on to the stack B If the precedence of operator is higher, pop two operands and evaluate C If the precedence of operator is lower, pop two operands and evaluate D 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.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Evaluate the following statement using infix evaluation algorithm and choose the correct answer. 1+2*3-2
 A 3 B 6 C 5 D 4
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.