OCR AS Level Computer Science H046/02 Algorithms and problem solving Exam Questions and, Exams of Medicine

OCR AS Level Computer Science H046/02 Algorithms and problem solving Exam Questions and CORRECT MARKING SCHEME

Typology: Exams

2025/2026

Available from 01/25/2026

OxfordTalent
OxfordTalent 🇬🇧

200 documents

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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

Partial preview of the text

Download OCR AS Level Computer Science H046/02 Algorithms and problem solving Exam Questions and and more Exams Medicine in PDF only on Docsity!

OCR AS Level Computer Science H046/02 Algorithms and problem solving Exam Questions and CORRECT MARKING SCHEME OCR Monday 19 May 2025 — Afternoon AS Level Computer Science H046/02 Algorithms and problem solving Time allowed: 1 hour 15 minutes Do not use: + acalculator 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. 3 BLANK PAGE DO NOT WRITE ON THIS PAGE © OCR 2025 Tum over (a 4 Players in a computer game collect items. Each item has a name, e.g. “Fruit” and a type, e.g. “Apple”. The items for player 1 are stored in a 2D array. The array is 0-indexed. The pseudocode declaration for the array is: array plItems [10,2] The first dimension stores the item name and the second dimension stores the type. ) One characteristic of the array is that it has 2 dimensions. Identify two other characteristics of the given array. Seca ceecsdeccueceueuucesueusseucuueesesuseusevuedeesuseusessvevudevcosstusesssesoustusesuseuseusecssonsevecsiuse Qo ecececseecsecsesesseesuececesececesueee cesses cesses cesuececesueecesuesuecassuessussuceassueccecesueesesassuesaussessecsuessueeeceuececeseeeeseeeees [2] (b) When the game starts, the pseudocode procedure initialiseArray will initialise each name and type in the array to "empty". ol procedure initialiseArray (plItems:byRef) 02 counter = 0 03 while counter < 10 04 pliItems[counter, 0] = "empty" 05 plitems[counter, 1] = "empty" 06 counter = counter + 1 o7 endwhile 08 endprocedure (i) State why empty is in speech marks on lines 04 and 05. Poseuee su ceestev se eeuesecueveceeseseueusoueusdeeseseueseouevscee se veveseouevecessevevessouevstsessoueusoessectuessoveueoeeseveuesecueveeseseuiuss [1] (ii) Rewrite the code in lines 02 to 07 to use a for loop instead of a while loop. Write your answer using pseudocode or program code. fc scuceceeeeuecececesesesusuencecesesesesusnencecesesesesusnenceceeesesesusneececeseseseausnersesesusneececeesesivansnseseceeeesivensneeseceeeete [2] 6 3. Astudent has written this algorithm in pseudocode: for x next =1to4 item = data[x] y=x-l while (y >= 0) and (item < datal[y]) data[y + 1] = dataly] yey-l endwhile data[y + 1] = item 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] Additional space for question 3 if required. data item ©OCR 2025 Turn over (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 Tum over 10 5 Aprogrammer has been given this pseudocode algorithm. Ol do 02 data = input ("Enter the code") 03 until data.length > 20 04 first = data.substring (0,1) 05 second = data.substring(1,1) 06 first = int(first) 07 second = int (second) 08 if first > second then 09 print (str(first) + "wins") 10 elseif first == second then 11 print ("It's a draw") 12 else 13 print (second + "wins") 14 endif The pseudocode algorithm calls different subroutines. (a) Identify two subroutines that are called in the pseudocode algorithm. (c) State the purpose of line 06. ©OCR 2025 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 2 13 1 21 0 10 The topPointer currently stores 2. (i) State the purpose of topPointer in the stack. ©OCR 2025 13 (ii) Describe the steps that will be followed to remove an item from the stack. (iii) Complete the function to insert a new data item onto the stack. function push (dataItem) Lf topPointer oo... cee eee ee eee eee eae 7 then return false else CLOPPOUNCSL = oo. e eee eee e eee e eee eee e eee eee eee eeeeeeeeee stack[topPointer] = 2... eee eee eee ee eee ee eee es return true endif endfunction BI © OCR 2025 Tum over 15 8 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 16 EXTRA ANSWER SPACE If you need extra space use this lined page. You must write the question numbers clearly in the margin. OCR 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 Bookle.. 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 faied 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 itselfa department cf the University of Cambridge. ©OCR 2025