Partial preview of the text
Download 2024 AQA A-LEVEL COMPUTER SCIENCE 7517/1 Paper 1 Merged Question Paper + Mark Scheme Actu and more Exams Computer Science in PDF only on Docsity!
Actual 2024 AQA A-LEVEL COMPUTER SCIENCE 7517/1 Paper 1 Merged Question Paper + Mark Scheme AQA A-level COMPUTER SCIENCE Paper 1 Monday 10 June 2024 Afternoon Time allowed: 2 hours 30 minutes Materials For this paper you must have: * acomputer ¢ aprinter appropriate software the Electronic Answer Document an electronic version and a hard copy of the Skeleton Program an electronic version and a hard copy of the Preliminary Material an electronic version of the Data files puzzle1.txt, puzzle2.txt, puzzle3.txt and puzzle4.txt. You must not use a calculator. Instructions ¢ Type the information required on the front of your Electronic Answer Document. ¢ Before the start of the examination make sure your Centre Number, Candidate Name and Candidate Number are shown clearly in the footer of every page (also at the top of the front cover) of your Electronic Answer Document. e Enter your answers into the Electronic Answer Document. Answer all questions. e Save your work at regular intervals. Information e The marks for questions are shown in brackets. e The maximum mark for this paper is 100. e No extra time is allowed for printing and collating. « The question paper is divided into four sections. Advice You are advised to allocate time to each section as follows: Section A — 40 minutes; Section B — 20 minutes; Section C — 20 minutes; Section D — 70 minutes. At the end of the examination Tie together all your printed Electronic Answer Document pages and hand them to the Invigilator. Warning It may not be possible to issue a result for this paper if your details are not on every page of your Electronic Answer Document. IB/G/Jun24/G4001/E12 7 517/1 1 Section A You are advised to spend no longer than 40 minutes on this section. Enter your answers for Section A in your Electronic Answer Document. You must save this document at regular intervals. State three advantages of using subroutines. For each advantage, you must explain how the advantage is achieved. [3 marks] Circular queues and linear queues are examples of data structures that can be implemented using a fixed-length array. [o[2].[4] Explain why, when implemented using a fixed-length array, a circular queue is usually considered to be a better choice of data structure than a linear queue. [2 marks] [o]2].[2] Describe the steps that must be completed to remove (dequeue) an item from a circular queue that has been implemented using a fixed-length array. [5 marks] [o[3].[1] Describe the Halting problem. [2 marks] [o[3].[2] Explain the importance of the Halting problem. [1 mark] IB/G/Jun24/7517/1 (3 + 4) * 5 isan example of an infix expression. The same expression has been represented in a different expression format in Figure 2. Figure 2 34+5 * [o[s].[1] What is the name of the expression format used in Figure 2? [1 mark] [o[s].[2] Represent the infix expression 5 + 2 * 3 + 4 inthe same expression format used in Figure 2. [2 marks] IB/G/Jun24/7517/1 Turn over for the next question Turn over > IB/G/Jun24/7517/1 Figure 5 contains pseudo-code for an algorithm that uses the arrays in Figure 4. Figure 5 Done € False Pos € -1 Current € 0 WHILE Done = False WHILE Current # -1 Pos © Pos + 1 Temp[Pos] © Current Current © Dirl [Current] ENDWHILE IF Pos = -1 THEN Done € True ELSE OUTPUT Data[Temp[Pos] ] Current © Dir2[Temp[Pos] ] Pos € Pos - 1 ENDIF ENDWHILE [o[e].[2] Complete the unshaded cells in Table 1 to show the result of tracing the algorithm shown in Figure 5 using the arrays in Figure 4. Table 1 Temp Done Pos [0] [1] [2] Current | OUTPUT Copy the contents of the unshaded cells in Table 1 into the table in your Electronic Answer Document. [7 marks] Turn over > IB/G/Jun24/7517/1 [ofe].[3] [o[s}.[4] [o[e].[5] IB/G/Jun24/7517/1 The array Temp needs to be able to store three values when used with the binary tree shown in Figure 3, on page 6. For some binary trees with only five nodes, the array Temp would need to be able to store five values. Describe the structure of a five-node binary tree that would require Temp to be able to store five values. [2 marks] State the type of data structure the algorithm shown in Figure 5 implements using the array Temp. [1 mark] Describe the changes that need to be made to the algorithm shown in Figure 5 so that the order that the data values are output in is reversed. In your answer, you should only describe changes to the existing lines of code in the algorithm; you must not suggest the addition of extra lines of code. [1 mark] IB/G/Jun24/7517/1 10 Section B You are advised to spend no more than 20 minutes on this section. Enter your answers to Section B in your Electronic Answer Document. You must save this document at regular intervals. The question in this section asks you to write program code starting from a new program/project/file. You are advised to save your program at regular intervals. Write a program that gets the user to enter an integer. It should keep doing this until they enter a value greater than 0. The program should then tell the user if they have entered a perfectly bouncy number, a bouncy number or a number that is not bouncy. A bouncy number is a number that is not an increasing number and not a decreasing number. An increasing number is one where each digit is greater than or equal to the previous digit in the number. A decreasing number is one where each digit is less than or equal to the previous digit in the number. A perfectly bouncy number is a bouncy number in which the number of digits that are followed by a larger digit is equal to the number of digits that are followed by a smaller digit. Examples ¢ 13578 is not a bouncy number because it is an increasing number. ¢ 973 is not a bouncy number because it is a decreasing number. © 98657 is a bouncy number. e 1111 is nota bouncy number because it is both an increasing number and a decreasing number. © 13421 is a perfectly bouncy number as exactly two digits are followed by a larger digit and there are also exactly two digits followed by a smaller digit. © 1829361 is a perfectly bouncy number as exactly three digits are followed by a larger digit and there are also exactly three digits followed by a smaller digit. © 13333331 is a perfectly bouncy number as there is exactly one digit followed by a larger digit and also exactly one digit followed by a smaller digit. 10 11 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. [1] Your PROGRAM SOURCE CODE [12 marks] [0[7].[2] SCREEN CAPTURE(S) showing the results of testing the program by entering the integers: ° -3 e 14982 e 1234 You will need to execute your program more than once to test all of the integers. [1 mark] Turn over for the next section Turn over > IB/G/Jun24/7517/1 11 Li[o].[4] Li[o][2] [i[o].[3] [i[o].[4] IB/G/Jun24/7517/1 13 This question is about the CheckForMatchWithPattern method in the Puzzle class. CheckForMatchWithPattern uses nested iteration and exception handling. State the name of another method in the Puzzle class that uses nested iteration. [1 mark] Explain what problem would occur if the first two iteration structures in the method CheckForMatchWithPattern had been inside the exception handling structure instead of outside it. [1 mark] Describe what exception handling is used for in the CheckForMatchWithPattern method. [3 marks] A value of 10 is returned sometimes when it should not be. Figure 6 and Figure 7 show example 4x4 grids. The pattern in Figure 6 correctly results in a value of 10 being returned. The pattern in Figure 7 also results in a value of 10 being returned, but it should return 0. Figure 6 Figure 7 x xX x Xx x Xx xX xX x xX Explain why the pattern in Figure 7 results in the value 10 being returned by the CheckForMatchWithPattern method. [1 mark] Turn over > 13 14 Section D You are advised to spend no more than 70 minutes on this section. Enter your answers to Section D in your Electronic Answer Document. You must save this document at regular intervals. These questions require you to load the Skeleton Program and to make programming changes to it. This question refers to the method Attempt Puzzle in the Puzzle class. The Skeleton Program is to be changed so that it checks the choice made by the user for the column number. A choice is valid if it is between one and the number of columns in the puzzle inclusive. You do not need to add checks for the row number. The program should keep getting the user to enter a value until a valid choice has been made. What you need to do Task 1 Modify the method Attempt Puzzle so it checks that the value entered by the user is valid. If an invalid value is entered, the user should be made to enter another value. Task 2 Test that the changes you have made work: e run the Skeleton Program © press the Enter key * enter 1 * enter 10 * enter 4 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. [1]1].[1] Your PROGRAM SOURCE CODE for the amended method Attempt Puzzle. [4 marks] [1]1].[2] SCREEN CAPTURE(S) showing the results of the requested test. [1 mark] IB/G/Jun24/7517/1 14 IB/G/Jun24/7517/1 16 This question extends the Skeleton Program by giving the user an option to shift all the cells in one row in the puzzle one place to the left. When shifting left, the first cell in the row will move to the last position in the row. Figure 8 shows an example puzzle and Figure 9 shows the result obtained from shifting all the cells in row 2 from the puzzle in Figure 8 one place to the left. Figure 8 1 2 3 4 5 6 7 8 16 17 Figure 9 1 2 3 4 5 6 7 8 1 @ After the cells have been shifted, the user’s score should be reduced by 20 and the new state of the grid and the user’s new score should be displayed. No other changes to the user’s score should be made. Shifting the cells does not count as a turn. After choosing to shift cells, the user should carry on with the rest of their turn by selecting a cell to place a symbol in. When answering this question, you should make sure your program code will work for any size of puzzle grid. What you need to do Task 1 Create a new method called ShiftCellsInRowLeft in the Puzzle class that takes an integer parameter that specifies the row number to use with the shift. Each cell, in the row indicated by the parameter, should be moved in Grid so that it is one place to the left; the leftmost cell should shift to the end of the row. Turn over > IB/GiJun24/7517/1 1 7 19 Turn over for the next question Turn over > IB/G/Jun24/7517/1 19 IB/G/Jun24/7517/1 20 This question extends the Skeleton Program so that there is a new type of cell—a countdown cell. A countdown cell has a timer associated with it that decreases by one each time the user tries to place a symbol in the puzzle grid. The location of a countdown cell is shown by a numeric digit representing the current value of its timer. When its timer reaches zero, the cell’s symbol changes to an @. A countdown cell should be added to the board each time the user’s score is increased. The location for the countdown cell should be an empty cell on the grid and selected randomly. What you need to do Task 1 Create a new class called CountdownCe11 that is a subclass of the BlockedCel1 class. Create a constructor for the CountdownCe11 class that sets the initial value of the timer and makes sure that the symbol displayed for the cell will be the value of its timer. The first symbol that should be displayed for the timer value of a CountdownCel1 is 3 Create a method UpdateCel1 in the CountdownCe11 class that: * overrides the method from the base class ¢ decreases the value of the timer by one * changes the symbol to @ when the timer has a value of zero. Task 2 Modify the Attempt Puzzle method in the Puzzle class so that, if the amount to add to the score is greater than zero, it selects an empty cell in the grid at random and replaces that cell with anew CountdownCell. Task 3 Modify the Attempt Puzzle method in the Puzzle class so that, immediately before it checks if the number of symbols left is ero, it calls the UpdateCell method for each cell in the grid. Task 4 Test that the changes you have made work: ¢ run the Skeleton Program ¢ load the file puzzle3 * enter 1 * enter 4 * enter X ¢ place aT in an empty cell ¢ place aT in an empty cell © place aT in an empty cell. 20