Question 3
AQA Computer Science June 2025 Paper 1 (7516/1)AS10 marks
On the specification
- 3.1
- 3.1 Fundamentals of programming3.3 Systematic approach to problem solving
- 3.2
- 3.3 Systematic approach to problem solving
- 3.3
- 3.3 Systematic approach to problem solving
Question text
3 Figure 5 shows an algorithm represented using pseudo-code. Figure 5 S ← "" WHILE S ≠ "x" OUTPUT "Enter a word or phrase: " INPUT S Max ← LENGTH(S) – 1 Matched ← True FOR i ← 0 TO Max Letter1 ← S[i] Letter2 ← S[Max - i] IF Letter1 ≠ Letter2 THEN Matched ← False ENDIF ENDFOR IF Matched = True THEN OUTPUT "Palindrome" ELSE OUTPUT "Not a palindrome" ENDIF ENDWHILE The strings are zero index based. For example, the character with index 0 in the string "ABCD" is "A". What you need to do: Task 1 Write a program to implement the algorithm in Figure 5. Task 2 Test that your program works: • run your program • enter madam • enter maam • enter adam • enter aam • enter x Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 3.1 Your PROGRAM SOURCE CODE for Task 1. [8 marks] 3.2 SCREEN CAPTURE(S) showing the test described in Task 2. [1 mark] 3.3 State one reason why the algorithm in Figure 5 is not efficient. [1 mark]