Question Paper & Mark Scheme (Merged)
Tuesday 13 May 2025 [VERIFIED]
, 2
Section A
You are advised to spend no more than 20 minutes on this section.
Enter your answers to Section A in your Electronic Answer Document. You must save this
document at regular intervals.
Question 03 in this section asks you to write program code starting from a new
program/project/file.
You are advised to save your program at regular intervals.
0 1 Figure 1 shows the data structures Letter, Land Rused by the algorithm shown in
Figure 2.
Figure 1
Letter L R
[0] [0] 5 [0] 20
[1] A [1] 18 [1] 23
[2] B [2] -1 [2] -1
[3] C [3] -1 [3] -1
D 2 24
[4] [4] [4]
E 9 1
[5] [5] [5]
F -1 -1
[6] G [6] 26 [6] 17
[7] H [7] -1 [7] -1
[8] I [8] 19 [8] 21
[9] J [9] -1 [9] -1
[10] K [10] 3 [10] 25
[11] L [11] -1 [11] -1
[12] M [12] 7 [12] 15
[13] N [13] 4 [13] 11
[14] O [14] -1 [14] -1
[15] P [15] -1 [15] -1
[16] Q [16] -1 [16] -1
R 12 -1
[17] [17] [17]
S 8 22
[18] [18] [18]
T 14 13
[19] U [19] 6 [19] -1
[20] V [20] -1 [20] -1
[21] W [21] 16 [21] 10
[22] X [22] -1 [22] -1
[23] Y [23] -1 [23] -1
[24] Z [24] -1 [24] -1
[25] [25] [25]
[26] [26] [26]
for more: tyrionpapers.com
IB/G/Jun25/7516/1
, 3
Figure 2
M "1001"
Current 0
FOR i 0 TO 3
Symbol M[i]
IF Symbol = "0" THEN Current
L[Current]
ELSE
Current R[Current] ENDIF
ENDFOR
OUTPUT Letter[Current]
Complete Table 1 by hand-tracing the algorithm in Figure 2.
The strings are zero index based. For example, the character with index 0 in the
string "ABCD" is "A".
You may not need to use all the rows in Table 1.
The first row of Table 1 has already been completed for you.
Table 1
M i Symbol Current Output
"1001" 0
Copy the contents of all the unshaded cells in Table 1 into your Electronic
Answer Document.
[3 marks]
Turn over for the next question
for more: tyrionTpu
aprenrs.o
covmer ►
IB/G/Jun25/7516/1
, 4
0 2 Figure 3 and Figure 4 show two blocks of pseudo-code.
Figure 3
INPUT X WHILE X
>0
X X–1
ENDWHILE
Figure 4
INPUT X REPEAT
X X–1
UNTIL X ≤ 0
Explain why the pseudo-code in Figure 3 operates differently to the pseudo-code in
Figure 4 when the inputs are negative numbers.
[2 marks]
0 3 Figure 5 shows an algorithm represented using pseudo-code.
Figure 5
S ""
WHILE S ≠ "x"
OUTPUT "Enter a word or phrase:" INPUT S
Max LENGTH(S) – 1
Matched True FOR i
0 TO Max
Letter1 S[i] Letter2 S[Max
- i]
IF Letter1 ≠ Letter2 THEN
Matched False ENDIF
ENDFOR
IF Matched = True THEN OUTPUT
"Palindrome"
ELSE
OUTPUT "Not a palindrome" ENDIF
ENDWHILE
The strings are zero index based. For example, the character with index 0 in the
string "ABCD" is "A".
for more: tyrionpapers.com
IB/G/Jun25/7516/1