Infix to Postfix Conversion Multiple choice Questions and Answers (MCQs)

YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

CLICK HERE TO DOWNLOAD

Infix to Postfix Conversion Multiple choice Questions and Answers (MCQs)

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When an operand is read, which of the following is done?
A
It is placed on to the output
B
It is placed in operator stack
C
It is ignored
D
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.

Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What should be done when a left parenthesis '(' is encountered?
A
It is ignored
B
It is placed in the output
C
It is placed in the operator stack
D
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.

Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is an infix expression?
A
(a+b)*(c+d)
B
ab+c*
C
+ab
D
abc+*
Question 3 Explanation: 
(a+b)*(c+d) is an infix expression. +ab is a prefix expression and ab+c* is a postfix expression.

Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the time complexity of an infix to postfix conversion algorithm?
A
O(N log N)
B
O(N)
C
O(N2)
D
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).

Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the postfix expression for the corresponding infix expression?

a+b*c+(d*e)
A
abc*+de*
B
abc+*de*
C
a+bc*de+*
D
abc*+(de)*
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.