Question 10

AQA Computer Science June 2025 Paper 1 (7517/1)A level8 marks

On the specification

10.1
4.3 Fundamentals of algorithms4.13 Systematic approach to problem solving
10.2
4.13 Systematic approach to problem solving
Question text

10 This question extends the Skeleton Program by allowing the player to use exponentiation in the expressions they enter. The player will be allowed to use the ^ symbol to denote exponentiation in an expression they enter. Exponentiation has higher precedence than the other operators. The four operators currently allowed in expressions are left-associative. Example 12-4-3 is equal to 5 as 12-4 is evaluated to 8 and then 8-3 is evaluated to 5 If subtraction was right-associative, then 12-4-3 would evaluate to 11 as 4-3=1 and 12-1=11 The exponentiation operator will be right-associative. Example 2^3^2 is equal to 512 as 3^2 is evaluated to 9 and then 2^9 is evaluated to 512 If exponentiation was left-associative, then 2^3^2 would evaluate to 64 as 2^3=8 and 8^2=64 What you need to do Task 1 Modify the CheckIfUserInputValid, ConvertToRPN and EvaluateRPN subroutines so the exponentiation operator is allowed and works correctly. Note: you will be able to achieve most of the marks for this question if you implement the exponentiation operator as left-associative. Task 2 Test that the changes you have made work: • run the Skeleton Program • select the training game • enter 512/2^3^2+8 • enter 3^2 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 10.1 Your PROGRAM SOURCE CODE for the amended subroutines CheckIfUserInputValid, EvaluateRPN, and ConvertToRPN. [7 marks] 10.2 SCREEN CAPTURE(S) showing the requested test. [1 mark]