Docsity

OCR AS Level Computer Science Exam Paper: Algorithms and Problem Solving, Exams of Computer science

Toggle sidebar
bg1
OCR AS LEVEL
COMPUTER
SCIENCE
2O25 OCR AS Level Computer Science
H046/02 Algorithms and problem solving
Verified Question paper with Marking
Scheme combined
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
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

Partial preview of the text

Download OCR AS Level Computer Science Exam Paper: Algorithms and Problem Solving and more Exams Computer science in PDF only on Docsity!

OCR AS LEVEL

COMPUTER

SCIENCE

2O25 OCR AS Level Computer Science

H046/02 Algorithms and problem solving

Verified Question paper with Marking

Scheme combined

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

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* Please write clearly in black ink. Do not write in the barcodes. Centre number First name(s) Last name Candidate number 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
BLANK PAGE
DO NOT WRITE ON THIS PAGE

© OCR 2025 Turn over

2 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 p1Items[10,2] The first dimension stores the item name and the second dimension stores the type. (a) One characteristic of the array is that it has 2 dimensions. Identify two other characteristics of the given array. 1 ....................................................................................................................................................... .......................................................................................................................................................... 2 ....................................................................................................................................................... .......................................................................................................................................................... [2] (b) When the game starts, the pseudocode procedure initialiseArray will initialise each name and type in the array to "empty". 01 procedure initialiseArray(p1Items:byRef) 02 counter = 0 03 while counter < 10 04 p1Items[counter, 0] = "empty" 05 p1Items[counter, 1] = "empty" 06 counter = counter + 1 7 endwhile 8 endprocedure (i) State why empty is in speech marks on lines 04 and 05. .......................................................................................................................................................... ..................................................................................................................................................... [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. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [2] © OCR 2025

3 A student has written this algorithm in pseudocode: for x = 1 to 4 item = data[x] y = x - 1 while (y >= 0) and (item < data[y]) data[y + 1] = data[y] y = y - 1 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

[6]

© OCR 2025

Additional space for question 3 if required. data

x item y 0 1 2 3 4

© 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. .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [1] © OCR 2025 Turn over

5 A programmer has been given this pseudocode algorithm. 01 do 02data = 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 09print(str(first) + "wins") 10 elseif first == second then 11 print("It's a draw") 12 else 13print(second + "wins") 14 endif The pseudocode algorithm calls different subroutines. (a) Identify two subroutines that are called in the pseudocode algorithm. 1 ....................................................................................................................................................... .......................................................................................................................................................... 2 ....................................................................................................................................................... .......................................................................................................................................................... [2] (b) Name the programming constructs that start on line 01 and line 08 in the pseudocode algorithm. 01 ...................................................................................................................................................... 08 ...................................................................................................................................................... [2] (c) State the purpose of line 06. .......................................................................................................................................................... ..................................................................................................................................................... [1] © OCR 2025

6 Two data structures are a queue and a stack. (a) Describe one difference between a queue and a stack. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [2] (b) The current contents of a stack created from an array called stack and pointer called topPointer are shown: index 7 6 5 4 3 2 1 0 stack 13 21 10 The topPointer currently stores 2. (i) State the purpose of topPointer in the stack. .......................................................................................................................................................... ..................................................................................................................................................... [1] © OCR 2025

(ii) Describe the steps that will be followed to remove an item from the stack. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [3] (iii) Complete the function to insert a new data item onto the stack. function push(dataItem) if topPointer ……………………………………………… 7 then return false else topPointer = ……………………………………………… stack[topPointer] = ……………………………………………… return true endif endfunction [3] © OCR 2025 Turn over

8 Show each pass of a bubble sort to sort the following string data into descending order. friendsunearthorangenighttime .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [4] END OF QUESTION PAPER © OCR 2025

EXTRA ANSWER SPACE

If you need extra space use this lined page. You must write the question numbers clearly in the margin. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. 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

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. It is 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

H046/02 Mark Scheme June 2025

MARKING INSTRUCTIONS

PREPARATION FOR MARKING
SCORIS
  1. Make sure that you have accessed and completed the relevant training packages for on-screen marking: RM Assessor Online Training: OCR Essential Guide to Marking.
  2. Make sure that you have read and understood the mark scheme and the question paper for this unit. These are available in RM Assessor
  3. Log-in to RM Assessor and mark the required number of practice responses (“scripts”) and the required number of standardisation responses. MARKING
  4. Mark strictly to the mark scheme.
  5. Marks awarded must relate directly to the marking criteria.
  6. The schedule of dates is very important. It is essential that you meet the RM assessor 50% and 100% (traditional 40% Batch 1 and 100% Batch 2) deadlines. If you experience problems, you must contact your Team Leader (Supervisor) without delay.
  7. If you are in any doubt about applying the mark scheme, consult your Team Leader by telephone or the RM assessor messaging system, or by email.
  8. Crossed Out Responses Where a candidate has crossed out a response and provided a clear alternative then the crossed out response is not marked. Where no alternative response has been provided, examiners may give candidates the benefit of the doubt and mark the crossed out response where legible. Rubric Error Responses – Optional Questions Where candidates have a choice of question across a whole paper or a whole section and have provided more answers than required, then all responses are marked and the highest mark allowable within the rubric is given. Enter a mark for each question answered into RM assessor, which will select the highest mark from those awarded. (The underlying assumption is that the candidate has penalised themselves by attempting more questions than necessary in the time allowed.) Multiple Choice Question Responses When a multiple choice question has only a single, correct response and a candidate provides two responses (even if one of these responses is correct), then no mark should be awarded (as it is not possible to determine which was the first response selected by the candidate). 2