Question 15
AQA Computer Science June 2023 Paper 1 (7516/1)AS14 marks
On the specification
- 15.1
- 3.1 Fundamentals of programming3.2 Fundamentals of data structures
- 15.2
- 3.3 Systematic approach to problem solving
- 15.3
- 3.3 Systematic approach to problem solving
Question text
15 This question extends the functionality of the Skeleton Program. The option to edit the source code is to be extended to allow lines to be deleted or inserted within a loaded source code program. The options within the EditSourceCode subroutine should now be: E – Edit this line D – Delete the current line I – Insert a new line above this line C – Cancel edit Option D should delete the current line without changing the size of the data structure. The lines after the deleted line need to be moved within the data structure so that there is no gap in the source code. Figure 4 shows an example where line 10 is being deleted. As a result lines 11 to 13 move. The size of the data structure does not change. Figure 4 You must write your own delete routine and not use any built-in delete function that might be available in the programming language you are using. Option I should allow the user to enter a new line to be inserted above the chosen line without changing the size of the data structure. The lines after the inserted line need to be moved within the data structure so they are not overwritten. You should check that there is sufficient space in the data structure to accommodate a new line. If there is not sufficient space, an error message should be displayed. Figure 5 shows an example where lines 4 to 11 move and a new line 4 is inserted. The size of the data structure does not change. Figure 5 You must write your own insert routine and not use any built-in insert function that might be available in the programming language you are using. What you need to do: Task 1 Amend the EditSourceCode subroutine to include the delete line option. Task 2 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • enter L • load prog1 • enter E • enter 10 • enter D Task 3 Amend the EditSourceCode subroutine to include the insert line option. Task 4 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • enter L • load prog2 • enter E • enter 4 • enter I • enter LABEL: SKP Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 15.1 Your PROGRAM SOURCE CODE for the entire subroutine EditSourceCode. [12 marks] 15.2 SCREEN CAPTURE(S) showing the requested test described in Task 2. The SCREEN CAPTURE(S) only need to show the test from entering option E until after the edited source code has been displayed. [1 mark] 15.3 SCREEN CAPTURE(S) showing the requested test described in Task 4. The SCREEN CAPTURE(S) only need to show the test from entering option E until after the edited source code has been displayed. [1 mark]