Computer Science · May / June 2023 · Paper 1 TZ2 SL · Question 8
Adapt for 2027Tracing a loop with a condition is taught, but the IB pseudocode should be rewritten in Python or Java.
IBCS
As printed in the paper
The question as text
8. Given the integer array DATA: DATA [0] [1] [2] [3] [4] [5] 7 21 5 19 6 2 and the following algorithm: K=0 A=0 B=0 loop while K<6 if DATA[K]>4 and DATA[K]<8 A=A+DATA[K] B=B+1 end if K=K+1 end loop C=A/B
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
8(a)[4]
8(b)[2]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

