Past-paper question · 2023 October-November · Paper 22 · Q8(a)

Question 8(a) 2023 · October-November · Paper 22 · 15 marks

Original past-paper question for 8(A)
Original past-paper question for 8(A)
Original past-paper question for 8(A)
Original past-paper question for 8(A)
Reveal official mark-scheme answer Official mark-scheme answer for 8(A)

Official answer for Question 8

Part (a)

✓
Solution using a loop

Question 7

✓
Example solution – using a loop
✓
FUNCTION GetPort(ThisDest : STRING) RETURNS INTEGER
✓
DECLARE Index, DNum, Port : INTEGER
✓
DNum STR_TO_NUM(ThisDest)
✓
Index 1
✓
Port -1
✓
REPEAT
✓
IF RouteTable[Index, 1] <> -1 THEN
✓
IF DNum >= RouteTable[Index, 1]
✓
AND __
✓
DNum <= RouteTable[Index, 2]
✓
THEN
✓
Port RouteTable[Index,
✓
3]
✓
ENDIF
✓
ENDIF
✓
Index Index + 1
✓
UNTIL Index = 7 OR Port <> -1 // end
✓
of array or
✓
range found
✓
RETURN Port
✓
ENDFUNCTION
✓
Mark as follows Max 7:
✓
1.Function heading and ending including parameter and return type
✓
2 Convert parameter to a number
✓
3 (Conditional) loop through array

Question 4

✓
Skip unused element in a loop

Question 5

✓
Attempt to check one range with destination in a loop

Question 6

✓
Test all ranges correctly with destination in a loop

Question 7

✓
Store port value if destination matched in a loop (and exit loop)
✓
8 Return port value including -1 if no match found
✓
Solution using selection statement(s)
✓
Example solution
✓
FUNCTION GetPort(ThisDest : STRING) RETURNS INTEGER
✓
DECLARE Index, DNum, Port : INTEGER
✓
DNum STR_TO_NUM(ThisDest)
✓
Port -1
✓
IF RouteTable[1, 1] <> -1 AND RouteTable[1, 1] >= DNum
✓
AND RouteTable[1, 2] <= DNum THEN
✓
Cambridge International AS & A Level – Mark Scheme
✓
9618/22
✓
October/November
✓
PUBLISHED
✓
2023
✓
Question
✓
Answer
✓
Marks
✓
Port RouteTable[1, 3]

Mark scheme 9618_w23_ms_22.pdf →

Show text version of question

Question 8

Part (a)

Question 8

[5]

Question 7

Part (b)

The original linked list is to be modified. A new node D6 is inserted between nodes D32 and

D11.

Ptr1 D40 D32 D11 D100 Ø

Ptr2 F1 F2 F3 F4 Ø

The algorithm required is expressed in four steps as shown.

Complete the steps.

1. Assign the data item .................................. to .................................. .

2. Set the .................................. of this node to point to .................................. .

3. Set Ptr2 to point to .................................. .

4. Set pointer of .................................. to point to .................................. .

[4]

Question 8

4 A procedure Count() will:

1. input a value (all values will be positive integers) 2. count the number of odd values and count the number of even values 3. repeat from step 1 until the value input is 99 4. output the two count values, with a suitable message.

The value 99 must not be counted.

Part (a)

Write pseudocode for the procedure Count().

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

[6]

Question 9

Topic relevance

Why this question appears here

82% assigned-topic match · Programming › Constructs

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_w23_qp_22.pdf

Keep practising this topic