Partial preview of the text
Download OCR - AS Level Computer Science- H046/02 Algorithms and problem solving - May 2025 - Quest and more Exams Ancient Greek in PDF only on Docsity!
em Any 20257 Qstin Papers Ming Schone Combined OCR Oxford Cambridge and RSA Monday 19 May 2025 — Afternoon AS Level Computer Science H046/02 Algorithms and problem solving Time allowed: 1 hour 15 minutes Do not use: * a calculator AE ET ; Please write clearly in black ink. Do not write in the barcodes. Centre number Candidate number First name(s) Last name Ne INSTRUCTIONS + Use black ink. + Write your answer to each question in the space provided. If you need extra space use the lined page 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 70. * The marks for each question are shown in brackets [ ]. * Quality of extended response will be assessed in questions marked with an asterisk (*). + This document has 16 pages. ADVICE + Read each question carefully before you start your answer. © OCR 2025 [601/5030/0] OCR is an exempt Charity DC (KS) 324952/8 Turn over 2 1 Agym owner would like a program for members to be able to book gym classes. Each class can have a maximum of 20 members. Members will enter their membership ID and then the date and time of the class they want to attend. Validation rules will check these details meet set rules. If they do not meet the validation tules then an error message will be displayed. A confirmation message will be displayed if the class is not full. A bleeping sound will play if the class is full. (a) Identify two inputs and two outputs for the program. (b) The programmer is identifying any possible reusable components in the program design. Explain why the programmer should create reusable program components. ©OCR 2025 3 BLANK PAGE DO NOT WRITE ON THIS PAGE © OCR 2025 Turn over 5 (iii) State one reason why the array should be passed by reference and not by value. (c) When a user collects an item, the name and type are added to the array plItems. At the end of the game, the name of each item collected is output. Write an algorithm, using pseudocode or program code, to: + output the name of each item in the array + output a suitable message if there are no items in the array. If the item is "empty" it should not be output. ©OCR 2025 Turn over 6 3. Astudent has written this algorithm in pseudocode: for x =1to4 item = data[x] y=zx-1 while (y >= 0) and (item < data[y]) data[y + 1] = datal[y] y=y-l endwhile data[y + 1] = item next x Test the algorithm by completing the trace table. The array data is a 1-dimensional array with 5 positions initialised with the data shown in the trace table. You should continue your answer on the next page if you need more space. data x item y 0 1 2 3 4 10 2 5 20 19 ©OCR 2025 [6] 8 4* Agroup of four students have decided to create a computer program to help teach younger children how to write programs in a text-based language. (a) They intend to divide the program into sub programs that they will develop individually before combining them together to form the final solution. The students are considering the agile methodologies or the waterfall lifecycle. Compare the use of the agile methodologies and waterfall lifecycle for the students’ project. You should include the following in your answer: + features of each software development methodology + benefits of each software development methodology in this scenario + drawbacks of each software development methodology in this scenario. (b) The students intend to use both black-box testing and white-box testing. Give one difference between black-box testing and white-box testing. © OCR 2025 Turn over 1 (d) The programmer needs to extend the program. The program will use a linear search. (i) The linear search has been written as a pseudocode function that: + takes an array called array of an unknown length as a parameter + takes a search value called value to search for as a parameter * uses a linear search to find the value in the array + returns true if the value is found and false otherwise. Complete the pseudocode function. function linearSearch (array, ..........222200- ) counter = 0 while counter.......... array.length if array[counter] == value then TOCUIN ooo eee eee eeeeeeeee ee eeeees endif counter = COUNTED 2... eee eee eee ee teeter ee endwhile endfunction [5] (ii) One alternative search algorithm is a binary search. Describe the steps in a binary search. © OCR 2025 Turn over 12 6 Two data structures are a queue and a stack. (a) Describe one difference between a queue and a stack. (b) The current contents of a stack created from an array called stack and pointer called topPointer are shown: index stack 1 21 0 10 The topPointer currently stores 2. (i) State the purpose of topPointer in the stack. ©OCR 2025 14 Write an algorithm, using program code or pseudocode to: + take a user’s date of birth as a string input in the format DD/MM/YYYY + take a year as input from the user in the format YYYY + output the age the user will be on their birthday in the year input in the format: You will be 18 on the 1 January 2029 You can use the function getMonth () to convert a 2-digit month into a string. For example: getMonth (02) willretum "February". You do not need to check the inputs are in the correct format. You should assume the year entered will always be in the future. ©OCR 2025 8 15 Show each pass of a bubble sort to sort the following string data into descending order. friend sun earth orange night time END OF QUESTION PAPER ©OCR 2025 OCR Oxford Cambridge and RSA GCE Computer Science H046/02: Algorithms and problem solving AS Level Mark Scheme for June 2025 Oxford Cambridge and RSA Examinations OCR (Oxford Cambridge and RSA) is a leading UK awarding body, providing a wide range of qualifications to meet the needs of candidates of all ages and abilities. OCR qualifications include AS/A Levels, Diplomas, GCSEs, Cambridge Nationals, Cambridge Technicals, Functional Skills, Key Skills, Entry Level qualifications, NVQs and vocational qualifications in areas such as IT, business, languages, teaching/training, administration and secretarial skills. Itis also responsible for developing new specifications to meet national requirements and the needs of students and teachers. OCR is a not-for-profit organisation; any surplus made is invested back into the establishment to help towards the development of qualifications and support, which keep pace with the changing needs of today’s society. This mark scheme is published as an aid to teachers and students, to indicate the requirements of the examination. It shows the basis on which marks were awarded by examiners. It does not indicate the details of the discussions which took place at an examiners’ meeting before marking commenced. All examiners are instructed that alternative correct answers and unexpected approaches in candidates’ scripts must be given marks that fairly reflect the relevant knowledge and skills demonstrated. Mark schemes should be read in conjunction with the published question papers and the report on the examination. © OCR 2025 Oxford Cambridge and RSA Examinations