OCR > A-Level Question Paper > OCR A Level Computer Science H446/02 Algorithms and programming JUNE 2022 (All)
A Level Computer Science H446/02 Algorithms and programming JUNE 2022 Time allowed: 2 hours 30 min INSTRUCTIONS • Use black ink. You can use an HB pen ... cil, but only for graphs and diagrams. • 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 140. • 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 36 pages. ADVICE • Read each question carefully before you start your answer. BLANK PAGE PLEASE DO NOT WRITE ON THIS PAGE Section A Answer all the questions. 1 A computer program stores data in an array named words. (a) The data in the array needs to be searched for a value that the user inputs. (i) One example of a searching algorithm is a binary search. Identify the precondition for a binary search. ........................................................................................................................................... ...................................................................................................................................... [1] (ii) A second example of a searching algorithm is a linear search. Describe how a linear search works. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ...................................................................................................................................... [4] (b) The array words is defined as a global variable and contains these values: "house" "boat" "car" "telephone" "garden" "spice" "elephant" The pseudocode function useWords() here uses the global array words. The number of words in the array words is passed as a parameter. function useWords(numberOfWords : byVal) contents = "" for count = 0 to numberOfWords - 1 contents = contents + words[count] + " " next count return contents endfunction (i) Identify two variables in the function useWords(). 1 ........................................................................................................................................ 2 ........................................................................................................................................ [2] (ii) numberOfWords is a parameter passed by value. Describe the difference between passing a parameter by value and by reference. ................................................................ [Show More]
Last updated: 2 years ago
Preview 1 out of 40 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
May 17, 2023
Number of pages
40
Written in
All
This document has been written for:
Uploaded
May 17, 2023
Downloads
0
Views
94
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·