This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Infix to Postfix Conversion”.

**1. Parentheses are simply ignored in the conversion of infix to postfix expression.**

A) True**B) False**

Explanation: A parenthesis is placed on the operator stack when it is encountered. When the corresponding parenthesis is encountered, the stack is popped and discarded until the other parenthesis is reached.

**2. It is easier for a computer to process a postfix expression than an infix expression.****A) True**

B) False

Explanation: A postfix expression is simple for computers to process because it keeps track of operator precedence.

**3. What is the postfix expression for the infix expression?**

a-b-c

A) -ab-c**B) ab – c –**

C) – -abc

D) -ab-c

Explanation: Ab-c-, not abc- -, is the corresponding postfix expression for the given infix expression.

**4. What is the postfix expression for the following infix expression?**

a/b^c-d

**A) abc^/d-**

B) ab/cd^-

C) ab/^cd-

D) abcd^/-

Explanation: The corresponding postfix expression for the infix expression is abc/d-, as determined by the infix to postfix conversion algorithm.

**5. Which of the following statement is incorrect with respect to infix to postfix conversion algorithm?**

A) operand is always placed in the output

B) operator is placed in the stack when the stack operator has lower precedence**C) parenthesis are included in the output**

C) higher and equal priority operators follow the same condition

Explanation: The performance does not contain parentheses. They are discarded after being put in the operator stack.

**6. In infix to postfix conversion algorithm, the operators are associated from?**

A) right to left**B) left to right**

C) centre to left

D) centre to right

Explanation: The operators in infix, prefix, and postfix expressions are connected from left to right, not right to left.

**7. What is the corresponding postfix expression for the given infix expression?**

a*(b+c)/d

A) ab*+cd/

B) ab+*cd/

C) abc*+/d**D) abc+*d/**

Explanation: The corresponding postfix expression is abc+*d/ while using the infix to postfix conversion algorithm.

**8. What is the corresponding postfix expression for the given infix expression?**

a+(b*c(d/e^f)*g)*h)

A) ab*cdef/^*g-h+**B) abcdef^/*g*h*+**

C) abcd*^ed/g*-h*+

D) abc*de^fg/*-*h+

Explanation: The corresponding postfix expression is abcdef/*g*h*+, as defined by the infix to postfix expression conversion algorithm using stack.

**9. What is the correct postfix expression for the following expression?**

a+b*(c^d-e)^(f+g*h)-i

A) abc^de-fg+*^*+i-

B) abcde^-fg*+*^h*+i-**C) abcd^e-fgh*+^*+i-**

D) ab^-dc*+ef^gh*+i-

Explanation: When we use the infix to postfix conversion algorithm, we find that the postfix expression for the given infix expression is abcde-fgh*+*+i-.

**10. From the given Expression tree, identify the correct postfix expression from the list of options.**

A) ab*cd*+**B) ab*cd-+**

C) abcd-*+

D) ab*+cd-

Explanation: The generated expression tree reveals that the infix expression is (ab)+ (c-d). When we convert it to postfix, we get abcd-+.

**11. 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

Explanation: When an operand is read during the conversion of an infix expression to a postfix expression, it is written to the output. When an operator is read, it is added to the stack of operators.

**12. 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

Explanation: A left parenthesis is added to the operator stack when it is encountered. When the right parenthesis is encountered, the stack is popped before the left parenthesis is encountered, and all parenthesis are removed.

**13. Which of the following is an infix expression?****A) (a+b)*(c+d)**

B) ab+c*

C) +ab

D) abc+*

Explanation: An infix expression is (a+b)*(c+d). A prefix expression is +ab, and a postfix expression is ab+c*.

**14. What is the time complexity of an infix to postfix conversion algorithm?**

A) O(N log N)**B) O(N)**

C) O(N^{2})

D) O(M log N)

Explanation: Mathematically, an infix to postfix expression conversion algorithm has a time complexity of O. (N).

**15.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)*+

Explanation: The corresponding postfix expression is abc*+de*+, as defined by the infix to postfix expression conversion algorithm.

Stack data structure is used to convert an infix expression to a postfix expression. A + B is an infix expression since the operator “+” comes between the operands “A” and “B.” Infix notation is useful for manually analysing expressions since it is easily understood by the human brain. The stack data structure will be used to translate infix expressions to postfix expressions. When we get any operands from scanning the infix expression from left to right, we simply add them to the postfix type, and for the operator and parenthesis, we add them to the stack while preserving their precedence.