Download OCR GCSE Computer Science Exam 2025: Computational Thinking, Algorithms, and Programming and more Exams Computer science in PDF only on Docsity!
OCR GCSE
COMPUTER
SCIENCE
2O25 OCR GCSE Computer Science J277/
Computational thinking, algorithms and
programming
Question paper with Marking scheme
attached
INSTRUCTIONS
- Use black ink.
- Write your answer to each question in the space provided. If you need extra space use the lined pages at the end of this booklet. The question numbers must be clearly shown.
- Answer all the questions. INFORMATION
- The total mark for this paper is 80.
- The marks for each question are shown in brackets [ ].
- This document has 20 pages. ADVICE
- Read each question carefully before you start your answer.
- We advise you to spend approximately 50 minutes on Section A and approximately 40 minutes on Section B.
Oxford Cambridge and RSA Tuesday 20 May 2025 – Afternoon GCSE (9–1) Computer Science
J277/02 Computational thinking, algorithms and programming
Time allowed: 1 hour 30 minutes Do not use:
Please write clearly in black ink. Do not write in the barcodes. Centre number First name(s) Last name Candidate number INSTRUCTIONS
- Use black ink.
- Write your answer to each question in the space provided. If you need extra space use the lined pages at the end of this booklet. The question numbers must be clearly shown.
- Answer all the questions. INFORMATION
- The total mark for this paper is 80.
- The marks for each question are shown in brackets [ ].
- This document has 20 pages. ADVICE
- Read each question carefully before you start your answer.
- We advise you to spend approximately 50 minutes on Section A and approximately 40 minutes on Section B. © OCR 2025 [601/8355/X] OCR is an exempt Charity DC (WW/JG) 355817/3 Turn over
2 This flowchart uses iteration. Start INPUT x OUTPUT "OK" x = x - 2 FALSE IS x < 0? TRUE End (a) Complete the table by identifying how many times "OK" will be output for when each value is input. Input value Number of times "OK" is output 3 10 [2] (b) Iteration is a programming construct. (i) Identify and describe two different examples of iteration that can be used in a high-level language. 1 ....................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... 2 ....................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... [4] © OCR 2025 Turn over
(ii) Give the names of two other programming constructs that are used in a high-level language. 1 ....................................................................................................................................................... 2 ....................................................................................................................................................... [2] (c) A programmer implements the flowchart as a program in a high-level language using an Integrated Development Environment (IDE). Identify and describe two tools that the programmer could use in the IDE to create a program from the flowchart. Tool 1 ................................................................................................................................................ Description ....................................................................................................................................... .......................................................................................................................................................... Tool 2 ................................................................................................................................................ Description ....................................................................................................................................... .......................................................................................................................................................... [4] © OCR 2025
(b) Tick (✓) one box in each table to complete the descriptions. An insertion sort… Tick (✓) one box uses an array of numbers with a sorted part and unsorted part picks out the middle value to begin with merges arrays of numbers together A bubble sort compares pairs of values and then: Tick (✓) one box always swaps them swaps them if they are in the correct order swaps them if they are in the incorrect order A sorting algorithm can sort data in an array. An array: Tick (✓) one box is declared with a fixed length stores multiple values that cannot be changed while the program is running can only be declared with a maximum of one-dimension (1D) [3] (c) An algorithm can be used to search for a value in an array. The algorithm follows these steps:
- compares the first value in the array to the value being searched for
- stops if the comparison is true
- moves to the next value in the array if the comparison if false. (i) Give the name of the searching algorithm described. ..................................................................................................................................................... [1] (ii) Identify one other condition that will cause the algorithm to stop. ..................................................................................................................................................... [1] © OCR 2025
4 An algorithm is written to read numbers from the external text file data.txt Each number is checked when it is read from the external text file. The number is output to the user if it is not 0. (a) Complete the algorithm using the OCR Exam Reference Language statements in the box. Not all statements are used. data for if myFile.close() myFile.readLine() input() myFile.writeLine() open print temp txt x myFile = ................................................................. ("data.txt") while NOT myFile.endOfFile() temp = ................................................................. if int (.................................................................) != 0 .................................................................(temp) endif endwhile ................................................................. [5] (b) Identify how casting is used in this algorithm. .......................................................................................................................................................... ..................................................................................................................................................... [1] © OCR 2025 Turn over
(c) Computational thinking techniques were used to design the security system. Draw one line to match each computational thinking technique to its correct example. Computational thinking Example technique Abstraction Decomposition Algorithmic thinking The system is broken down into modules for security and payments. There is an increase in the amount of RAM in the computer running the system The user’s identity, PIN and password are required. All other data is ignored. The step-by-step process for users to securely pay online is designed. [3] © OCR 2025 Turn over
(d) As part of the security system, the user is asked to choose a 4-digit value for their PIN. This PIN cannot be 1234 or 4321 Create an algorithm that:
- takes the PIN as input as a string
- checks that the PIN is 4 characters in length
- checks that the PIN is not either “1234” or “4321”
- outputs "VALID PIN" if the PIN meets all of the criteria
- outputs "INVALID PIN" if the PIN does not meet all of the criteria. You do not need to check that the digits entered are numeric. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [6] © OCR 2025
(b) The database table TblMusic stores data about the music acts. Some of the data in TblMusic is shown: ActID Stage Day SetLength 1 Platinum Saturday 0. 2 Hills Saturday 1. 3 Triangle Sunday 1. 4 Platinum Sunday 0. An SQL statement has been written to show ActID and Stage for all acts playing on Saturday. The SQL statement is incorrect. SELECT ActID AND Stage FROM TblActs IF Day = Saturday (i) Refine the SQL statement to correct the errors. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [4] (ii) Identify one example of a record from TblMusic .......................................................................................................................................................... ..................................................................................................................................................... [1] (iii) Give the most appropriate data type for each field shown. Field name Data stored Data type Stage The name of the stage SetLength The length of each set in hours [2] © OCR 2025
(c) Tickets to the festival are £60 each. Visitors can buy multiple tickets. For example, a visitor buying 4 tickets would pay £240. (i) Write a function, calculatePrice() that:
- takes the number of tickets to be purchased as a parameter
- calculates and returns the total price to pay. You must use either:
- OCR Exam Reference Language, or
- a high-level programming language that you have studied. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [4] (ii) Write an algorithm that:
- uses the function calculatePrice() to find the price for a visitor buying 3 tickets
- stores the result in the variable totalPrice You must use either:
- OCR Exam Reference Language, or
- a high-level programming language that you have studied. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [2] © OCR 2025 Turn over
(ii) The array actNumbers is changed to include data for two more stages. The new array is shown: Index Data
actNumbers The algorithm from part (i) needs refining to work for the new array. The algorithm is repeated here: 01 count = 0 02 for x = 0 to 2 3 count = count + actNumbers[x] 4 next x 5 print(count) Identify the line number that will need to be changed for the new array and write the updated line of code. Line number ..................................................................................................................................... Updated code ................................................................................................................................... .......................................................................................................................................................... [2] (iii) Refine line 05 in the algorithm to output "The total act count is " and then the content of the variable count For example: The total act count is 50 New line 05 ...................................................................................................................................... ..................................................................................................................................................... [1] © OCR 2025 Turn over
(e) There are 500 tickets available for the music festival. The number of tickets currently available is stored in the variable tickets Complete the algorithm to:
- prompt the user to enter how many tickets they would like and take this value as input
- output "Tickets booked" and reduce the value stored in tickets if there are enough tickets available
- output "Not enough tickets" if there are not enough tickets available
- repeat the steps until there are no tickets left. You must use either:
- OCR Exam Reference Language, or
- a high-level programming language that you have studied tickets = 500 .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [6] END OF QUESTION PAPER © OCR 2025
© OCR 2025
© OCR 2025