logo

AQA A-Level Computer Science practice

Convert the infix expression (A + B) * (C - D) into RPN. Explain how the order of the RPN expression represents the brackets.

Try the question first, then check the answer and practise the same topic again.

At a glance

Question

Type

practice

Style

Topic

Reverse Polish

Exam-style question

Try this first

Convert the infix expression (A + B) * (C - D) into RPN. Explain how the order of the RPN expression represents the brackets.

Answer and explanation

Concise answer

AB+CD-*

Why this is correct

The first bracketed sub-expression, A + B, becomes AB+. The second bracketed sub-expression, C - D, becomes CD-. The multiplication operator is placed after both completed sub-expressions, producing AB+CD-*. The position of the operators preserves the order imposed by the brackets, so additional brackets are not required in the RPN form.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions