100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

OCR 2023 COMPUTER SCIENCE H046/02: ALGORITHMS AND PROBLEM SOLVING AS LEVEL QUESTION PAPER & MARK SCHEME (MERGED)

Rating
-
Sold
-
Pages
42
Grade
A+
Uploaded on
09-05-2024
Written in
2023/2024

A program uses a bubble sort to sort data into ascending numerical order. The data is stored in a 0-indexed 1-dimensional array. (a) Show each stage of a bubble sort to sort this data into ascending numerical order: 1 5 3 9 2 7 You should clearly show and label each pass in your answer. ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ...........................................................................................................................................[4] 5 Turn over (b) A programmer has partially developed a bubble sort algorithm in pseudocode. This will partially sort an array of numbers called numbers that is passed as a parameter. 01 procedure bubbleSort(numbers : byRef) 02 flag = true 03 for x = 0 to h – 1 04 if numbers[x] > numbers[x + 1] then 05 holdValue = numbers[x] 06 numbers[x] = numbers[x + 1] 07 numbers[x + 1] = holdValue 08 flag = false 09 endif 10 next x 11 endprocedure (i) Explain why the procedure bubbleSort accepts the array numbers by reference and not by value. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... . ..................................................................................................................................[3] (ii) The programmer has used a for loop on line 3 in the procedure bubbleSort. A for loop is a count controlled loop. State what is meant by the term ‘count controlled loop

Show more Read less
Institution
Graduation In Computer Science
Course
Graduation in computer science











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Graduation in computer science
Course
Graduation in computer science

Document information

Uploaded on
May 9, 2024
Number of pages
42
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
AnyaTaylor A.T. Still University
View profile
Follow You need to be logged in order to follow users or courses
Sold
98
Member since
1 year
Number of followers
25
Documents
1934
Last sold
3 days ago
Williams Tech.Smartlearners

4.3

16 reviews

5
11
4
2
3
1
2
0
1
2

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions