logo

AQA A-Level Computer Science practice

Convert the RPN expression 7 2 - 3 + into infix form and describe how a stack can be used to evaluate it.

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 RPN expression 7 2 - 3 + into infix form and describe how a stack can be used to evaluate it.

Answer and explanation

Concise answer

(7 - 2) + 3

Why this is correct

The operands 7 and 2 are followed by -, so they form the sub-expression (7 - 2). The next operand is 3 and the final operator is +, giving (7 - 2) + 3. To evaluate it with a stack, push 7, push 2, apply -, and push the result 5. Push 3, apply +, and push the final result 8.

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