Data Structures · Question 22 · Medium

What is the prefix (Polish) form of the infix expression (A + B) * (C - D) ?

  1. + A B * - C D
  2. * A + B - C D
  3. A B + C D - *
  4. * + A B - C D
Answer and explanation

Answer: D. * + A B - C D

Explanation: Convert each bracket first: A + B becomes + A B and C - D becomes - C D. The * operator is applied to both, giving * + A B - C D. A B + C D - * is the postfix form.

Previous: The keys 45, 20, 60, 10, 30, 25, 50 are inserted in that order into an empty… · Next: The keys 12, 22, 35, 42, 55, 7, 17 are inserted into a hash table of size 10…

Practise data structures

Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.

More data structures questions

More technical & programming practice

Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge