Docsity

OCR GCSE (9–1) Computer Science J277/02 Computational thinking, algorithms and programmi, Exams of Medicine

Toggle sidebar
bg1
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:
•a calculator
Please write clearly in black ink. Do not write in the barcodes.
Centre number
Candidate number
First name(s)
Last name
OCR GCSE (9–1) Computer Science
J277/02 Computational thinking, algorithms
and programming Questions and
CORRECT Answers 2025
Oxford Cambridge and RSA
INSTRUCTIONS
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36

Partial preview of the text

Download OCR GCSE (9–1) Computer Science J277/02 Computational thinking, algorithms and programmi and more Exams Medicine in PDF only on Docsity!

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:

  • a calculator Please write clearly in black ink. Do not write in the barcodes. Centre number Candidate number First name(s) Last name

OCR GCSE (9–1) Computer Science

J277/02 Computational thinking, algorithms

and programming Questions and

CORRECT Answers 2025

Oxford Cambridge and RSA 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] DC (WW/JG) 355817/ OCR is an exempt Charity Turn over
  • 1 8 6 0 3 9 6 2 5 3 *

© OCR 2025 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 test data Normal test data Boundary test data Invalid / erroneous 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^ Turn^ over Start INPUT x OUTPUT "OK" x = x - 2 FALSE IS x < 0? TRUE End 2 This flowchart uses iteration. (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

(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 [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 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:

  • the user has entered either their correct password or has entered their correct PIN
  • the card is not blocked. (a) Draw the logic circuit for the security system A B P C [3] (b) Complete the truth table for P = A AND B A B P [2]

© 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 technique Example [3] The step-by-step process for users to securely pay online is designed. Algorithmic thinking The user’s identity, PIN and password are required. All other data is ignored. Decomposition There is an increase in the amount of RAM in the computer running the system Abstraction The system is broken down into modules for security and payments.

© OCR 2025^ Turn^ over 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:

  • checks if the passwords stored in passA and passB are the same
  • outputs "passwords match" if they are the same
  • outputs "passwords do not match" if they are not the same. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... . ................................................................................................................................................. [3]

© 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 (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 actNumbers This algorithm adds up the total number of acts on all three stages. 01 count = 0 02 for x = 0 to 2 03 count = count + actNumbers[x] 04 next x 05 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^ Turn^ over (ii) The array actNumbers is changed to include data for two more stages. The new array is shown: Index 0 1 2 3 4 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 03 count = count + actNumbers[x] 04 next x 05 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

EXTRA ANSWER SPACE

If you need extra space use these lined pages. You must write the question numbers clearly in the margin. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. ..................................................................................................................................................................

© OCR 2025