Past-paper question · 2024 May-June · Paper 42 · Q3(c)(i)

Question 3(c)(i) 2024 · May-June · Paper 42 · 4 marks

Original past-paper question for 3(C)(I)
Original past-paper question for 3(C)(I)
Original past-paper question for 3(C)(I)
Original past-paper question for 3(C)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 3(C)(I)

Official answer for Question 3

Part (c)

(i)

Question 1

mark each

Question 4

✓
Insertion algorithm written with correct identifier – no recursion
✓
External loop while there are still elements left (e.g. NumberElements > 0)
✓
Internal loop and selection accurate
✓
Nothing additional added / logic changed
✓
e.g.
✓
Java
✓
public static Integer[] IterativeInsertion(Integer[] IntegerArray, Integer NumberElements){
✓
Integer LastItem;
✓
Integer CheckItem;
✓
while(NumberElements > 0){
✓
LastItem = IntegerArray[NumberElements - 1];
✓
CheckItem = NumberElements - 2;
✓
Boolean LoopAgain = true;
✓
if(CheckItem < 0){
✓
LoopAgain = false;
✓
}else if(IntegerArray[CheckItem] < LastItem){
✓
LoopAgain = false;
✓
}
✓
while(LoopAgain){
✓
IntegerArray[CheckItem + 1] = IntegerArray[CheckItem];
✓
CheckItem = CheckItem - 1;
✓
if(CheckItem < 0){
✓
LoopAgain = false;
✓
}else if(IntegerArray[CheckItem] <= LastItem){
✓
LoopAgain = false;
✓
}
✓
}
✓
9618/42
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_s24_ms_42.pdf →

Show text version of question

Question 3

Part (c)

(i)

Question 3

A program sorts an array of integers and searches the array for a particular value.

The function RecursiveInsertion()can be changed to use iteration instead of recursion.

(i)

Write program code for the function IterativeInsertion()to perform the same

processes as RecursiveInsertion()but using iteration instead of recursion.

Save your program.

Copy and paste the program code into part 3(c)(i) in the evidence document.

[4]
Topic relevance

Why this question appears here

98% assigned-topic match · Computational thinking and problem-solving › Recursion

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9618_s24_qp_42.pdf

Keep practising this topic