Infix to Postfix Conversion Multiple choice Questions and Answers (MCQs)
Click on any option to know the CORRECT ANSWERS
When an operand is read, which of the following is done?
It is placed on to the output
It is placed in operator stack
It is ignored
Operator stack is emptied
Question 1 Explanation:
While converting an infix expression to a postfix expression, when an operand is read, it is placed on to the output. When an operator is read, it is placed in the operator stack.
What should be done when a left parenthesis '(' is encountered?
It is ignored
It is placed in the output
It is placed in the operator stack
The contents of the operator stack is emptied
Question 2 Explanation:
When a left parenthesis is encountered, it is placed on to the operator stack. When the corresponding right parenthesis is encountered, the stack is popped until the left parenthesis and remove both the parenthesis.
Which of the following is an infix expression?
Question 3 Explanation:
(a+b)*(c+d) is an infix expression. +ab is a prefix expression and ab+c* is a postfix expression.
What is the time complexity of an infix to postfix conversion algorithm?
O(N log N)
O(M log N)
Question 4 Explanation:
The time complexity of an infix to postfix expression conversion algorithm is mathematically found to be O(N).
What is the postfix expression for the corresponding infix expression?
Question 5 Explanation:
Using the infix to postfix expression conversion algorithm, the corresponding postfix expression is found to be abc*+de*.
There are 5 questions to complete.