












































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
2O25 0CR GCSE Computer Science J277/02 Computational thinking, algorithms and programming Question Paper and 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.
Typology: Exams
1 / 52
This page cannot be seen from the preview
Don't miss anything!













































INSTRUCTIONS
Section A We advise you to spend approximately 50 minutes on Section A. 1 A program asks a user to enter a number. Only integer values between 1 and 100 (inclusive) are accepted. The program is tested. (a) Tick (✓) one or more boxes in each row to identify the type or types of test for each example of test data. Example Normal Boundary Invalid / erroneous test data test data test data test data 27 "Hello" 105 100 [4] (b) An algorithm is written for the program. (i) Complete the algorithm for the program. num = input("Enter a number between 1 and 100") if num ........................................ AND ........................................ then print("accepted") ........................................ print("not accepted") endif [3] (ii) Give the identifier of one variable used in the algorithm in part (b)(i). ..................................................................................................................................................... [1] (iii) Give one Boolean operator used in the algorithm in part (b)(i). ..................................................................................................................................................... [1] © OCR 2025
(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
(a) Show the steps that a merge sort would take to put the data set into ascending numerical order. 2,7,3,1,9,6,5, [4] © OCR 2025 Turn over
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
5 A security system protects online credit card payments. The system has three inputs: Input Description A True when the user enters their correct password B True when the user enters their correct PIN C True when the card is blocked The output (P) is True if both of the following conditions are True:
© OCR 2025
(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:
Section B We advise you to spend approximately 40 minutes on Section B. Some questions require you to respond using either the OCR Exam Reference Language or a high-level programming language you have studied. These are clearly shown. 6 OCR Rockfest is a yearly music festival. Visitors buy tickets to attend and watch the music acts. A computer system is created to sell tickets and store information about visitors and the music acts. (a) Visitors are asked to choose a password. The password is entered twice and stored in the variables passA and passB (i) Tick (✓) one box to identify the correct OCR Exam Reference Language statements for the design of this task. OCR Exam Reference Language to enter two passwords Tick (✓) one box passA and passB = input("enter password twice") input("enter your password") = passA input("enter your password again") = passB passA = input("enter your password") passB = input("enter your password again") "passA" = input("enter your password") "passB" = input("enter your password again") [1] (ii) Design an algorithm that:
(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:
(d) The number of different music acts on each of the three stages is stored in the array actNumbers. Each index of the array represents one stage. Index 0 1 2 Data (^10 14 ) actNumbers This algorithm adds up the total number of acts on all three stages. 01 count = 0 02 for x = 0 to 2 3 count = count + actNumbers[x] 4 next x 5 print(count) (i) Complete the trace table for the algorithm. You may not need to use all rows in the table. Line number count^ x^ Output [4] © OCR 2025
(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:
If you need extra space use these lined pages. You must write the question numbers clearly in the margin. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. © OCR 2025
© OCR 2025
Oxford Cambridge and RSA Copyright Information OCR is committed to seeking permission to reproduce all third-party content that it uses in its assessment materials. OCR has attempted to identify and contact all copyright holders whose work is used in this paper. To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced in the OCR Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download from our public website (www.ocr.org.uk) after the live examination series. If OCR has unwittingly failed to correctly acknowledge or clear any third-party content in this assessment material, OCR will be happy to correct its mistake at the earliest possible opportunity. For queries or further information please contact The OCR Copyright Team, The Triangle Building, Shaftesbury Road, Cambridge CB2 8EA. OCR is part of Cambridge University Press & Assessment, which is itself a department of the University of Cambridge. © OCR 2025