YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS
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?
one | |
two | |
three | |
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?
One | |
Two | |
Three | |
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/b+(c-d) | |
abc*+d+ab+cd+*ce-f- | |
ab-c- | |
+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?
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.
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
3 | |
6 | |
5 | |
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.