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

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

**1. Out of the following operators (|, *, +, &, $), the one having lowest priority is ________**

A) +

B) $**C) |**

D) &

Explanation: The logical OR would have the lowest priority as a result of the algorithm (infix-prefix).

**2. What would be the Prefix notation for the given equation?**

A^B^C^D

**A) ^^^ABCD**

B) ^A^B^CD

C) ABCD^^^

D) AB^C^D

Explanation: Reverse the equation, or check it from left to right. The infix-prefix algorithm should be used. It’s important to note that exponentiation has a right-to-left associativity order. As a result, the stack continues to push. As a result, the result is ABCD.

**3. What would be the Prefix notation for the given equation?**

a+b-c/d&e|f

**A) |&-+ab/cdef**

B) &|-+ab/cdef

C) |&-ab+/cdef

D) |&-+/abcdef

Explanation: Reverse the equation, or check it from left to right. The infix-prefix algorithm should be used. In ascending order, the preferences are |&+*/

**4. What would be the Prefix notation for the given equation?**

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

A) -+a*/^bcdef**B) -+a*/bc^def**

C) -+a*b/c^def

D) -a+*/bc^def

Explanation: Reverse the equation, or check it from left to right. The infix-prefix algorithm should be used. The following is the preference order in ascending order +*/. Brackets are given top priority. First, the equations inside the brackets are solved.

**5. What would be the Prefix notation and Postfix notation for the given equation?**

A+B+C

**A) ++ABC and AB+C+**

B) AB+C+ and ++ABC

C) ABC++ and AB+C+

D) ABC+ and ABC+

Explanation: Reversing the given equation and solving it as a standard infix-postfix query is needed for prefix notation. We can see that it does not produce the same results as a standard infix-postfix conversion.

**6. What would be the Prefix notation for the given equation?**

a|b&c

A) a|&bc

B) &|abc**C) |a&bc**

D) ab&|c

Explanation: The following is the order of operator choice (descending): &

For evaluation, the equation a|b&c will be parenthesized as (a|(b&c)).

As a result, the prefix notation equation equals |a&bc.

**7. What data structure is used when converting an infix notation to prefix notation?****A) Stack**

B) Queue

C) B-Trees

D) Linked-list

Explanation: To begin, reverse the given equation and use the infix to postfix expression algorithm. Stacks are the data structure used here.

**8. What would be the Prefix notation for the given equation?**

A+(B*C)

A) +A*CB

B) *B+AC**C) +A*BC**

D) *A+CB

Explanation: Reverse the equation, or check it from left to right. Use the infix-postfix method. The equation inside the bracket evaluates to CB*, while the equation outside the bracket evaluates to A+, yielding CB*A+. When we reverse this, we get +A*BC.

**9. What would be the Prefix notation for the given equation?**

(A*B)+(C*D)

**A) +*AB*CD**

B) *+AB*CD

C) **AB+CD

D) +*BA*CD

Explanation: Reverse the equation, or check it from left to right. Use the infix-postfix method. In the end, the equations within the brackets evaluate to DC* and BA*, respectively, giving us DC*BA*+. We get the +*AB*CD.advertisement by reversing this.

**10. What would be the Prefix notation for the given equation?**

A+B*C^D

**A) +A*B^CD**

B) +A^B*CD

C) *A+B^CD

D) ^A*B+CD

Explanation: Reverse the equation, or check it from left to right. The infix-prefix algorithm should be used. The following is the ascending order of choice +*. Operators are pushed into the stack and then popped if their option exceeds the one being pushed. At the end of the operation, all operators are popped. DCB*A+ is the product of the equation. We get the following result by reversing this.

**11. Out of the following operators (^, *, +, &, $), the one having highest priority is _________**

A) +

B) $**C) ^**

D) &

Explanation: The exponentiation would have the highest priority, according to the algorithm (infix-prefix).

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. Three distinct but similar types of writing expressions are infix, postfix, and prefix notations. The variations are easier to see when looking at instances of operators that take two operands. Between their operands, operators are posted.