Computer Science · May / June 2022 · Paper 1 SL · Question 14
Adapt for 2027Linear and binary search tracing and comparison are in B2.4.2, but the algorithms should be rewritten in Python or Java.
IBCS
As printed in the paper
The question as text
14. The array DATA_ARR[] is a one-dimensional array of 12 integers. [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] 27 29 36 39 40 42 45 50 58 60 61 68 Algorithm 1 represents a method of searching the array DATA_ARR[] to see if it contains a specific value. Algorithm 1 input TO_FIND LIMIT = 11 LOC = FALSE ITERATE = 0 loop while not LOC and ITERATE <= LIMIT if DATA_ARR[ITERATE] = TO_FIND then LOC = TRUE end if ITERATE = ITERATE + 1 end loop if LOC then output TO_FIND, "is in the array" else output TO_FIND, "is NOT in the array" end if
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
14(a)[4]
14(b)[1]
14(c)[4]
14(d)[1]
14(e)[5]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

