Question 6

OCR Computer Science June 2025 Computational thinking, algorithms and programming (J277-02)GCSE30 marks

On the specification

(a)(i)
2.2 Programming fundamentals
(a)(ii)
2.1 Algorithms2.2 Programming fundamentals
(b)(i)
2.2 Programming fundamentals
(b)(ii)
2.2 Programming fundamentals
(b)(iii)
2.2 Programming fundamentals
(c)(i)
2.2 Programming fundamentals
(c)(ii)
2.2 Programming fundamentals
(d)(i)
2.1 Algorithms2.2 Programming fundamentals
(d)(ii)
2.2 Programming fundamentals
Question text

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. Tick (✓) OCR Exam Reference Language to enter two passwords 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] (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.5 2 Hills Saturday 1.5 3 Triangle Sunday 1.0 4 Platinum Sunday 0.5 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] (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] (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 6 actNumbers This algorithm adds up the total number of acts on all three stages. 1 count = 0 2 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] (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 10 14 6 9 11 actNumbers The algorithm from part (i) needs refining to work for the new array. The algorithm is repeated here: 1 count = 0 2 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] (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]