# Prefix to Infix Conversion Multiple Choice Questions and Answers (MCQs)

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

1. What would be the solution to the given prefix notation?

`- * 1 5 / * / 6 3 6 2`

A) 1
B) 0
C) -1
D) -2

Explanation: (15)-(6/3)6/2 is the infix notation for the given prefix notation. The equation yields a result of -1.

2. What would be the solution to the given prefix notation?

`* / + 1 2 / 4 2 + 3 5`

A) 12
B) 7.5
C) 9
D) 13.5

Explanation: ((1+2)/(4/2))(3+5) is the infix notation of the specified prefix notation, which solves to (3/2)8 and gives us 12.

3. Given a prefix and a postfix notation what are the difference between them?
A) The postfix equation is solved starting from the left whereas the prefix notation is solved from the right
B) The postfix equation is solved starting from the right whereas the prefix notation is solved from the left
C) Both equations are solved starting from the same side(right)
D) Both equations are solved starting from the same side(left)

Explanation: The postfix notation is solved from left to right, while the prefix notation is reversed after development, so it is solved from right to left.

4. When converting the prefix notation into an infix notation, the first step to be followed is ________
A) Reverse the equation
B) Push the equation to the stack
C) Push the equation onto the queue
D) Push the equation to the stack or queue

Explanation: The measures are as follows: the equation is inverted, put onto a stack, popped one by one, and the problem is solved. As a consequence, the first step is to rewrite the equation in the opposite direction.

5. The time complexity of converting a prefix notation to infix notation is _________
A) O(n) where n is the length of the equation
B) O(n) where n is number of operands
C) O(1)
D) O(logn) where n is length of the equation

Explanation: Reversing the equation (O(n)), moving them all onto the stack (O(n)), and popping them one by one and solving them (O(n)) are the processes involved. As a result, the answer is O(n), where n is the equation’s length.

6. Given two processes (conversion of postfix equation to infix notation and conversion of prefix notation to infix notation), which of the following is easier to implement?
A) Both are easy to implement
B) Conversion of postfix equation to infix equation is harder than converting a prefix notation to infix notation
C) Conversion of postfix equation to infix equation is easier than converting a prefix notation to infix notation
D) Insufficient data

Explanation: Since reversing the equation is required to convert prefix notation to infix notation, the latter is more difficult to implement than the postfix to infix method.

7. What would be the solution to the given prefix notation?

`- + 5 / 10 5 5`

A) 2
B) 5
C) 10
D) 7

Explanation: The infix notation of the given prefix notation is 5+10/5-5 which gives us 2 as our answer.

8. What would be the solution to the given prefix notation?

`/ / / / 16 4 2 1`

A) 1
B) 4
C) 2
D) 8

Explanation: Our answer is 1 because the infix notation to the specified prefix notation is 16/4/2/1. By traversing the equation from the right, the infix notation can be obtained from the prefix notation. public relations

9. What would be the solution to the given prefix notation?

`+ 9 * 3 / 8 4`

A) 14
B) 15
C) 18
D) 12

Explanation: (9+(3*(8/4)) is the infix notation for the given prefix notation, which equals 15. As a consequence, 15 is the correct answer.

10. What would be the solution to the given prefix notation?

`- + 1 2 * 3 / 6 2`

A) 6
B) -6
C) 3
D) -3

Explanation: The infix notation for the given prefix notation is (1+2)-3*(6/2). The result of the given equation is -6.

Polish in the opposite direction A postfix expression is known as notation, while a prefix expression is known as Polish Notation or Warsaw Notation. X + Y is an infix notation. Between their operands, operators are posted. This is how we usually write expressions. “First add B and C together, then multiply the result by A, then divide by D to get the final answer,” an expression like A * ( B + C ) / D is generally taken to mean.