- IB
- 4.2 Connecting computational thinking and program design
Practice 4.2 Connecting computational thinking and program design with authentic IB Computer Science (CS) exam questions for both SL and HL students. This question bank mirrors Paper 1, 2, 3 structure, covering key topics like programming concepts, algorithms, and data structures. Get instant solutions, detailed explanations, and build exam confidence with questions in the style of IB examiners.
For an identified application, explain why a binary search would be preferred to a linear search.
Describe the steps involved in using the bubble sort algorithm to sort an array.
List the output from the given algorithm for the following input.
2, 6, 8, 9, 12, 15, 18, 20
loop for Count from 0 to 7
input NUMBER
if NUMBER div 2 = NUMBER / 2 then
if NUMBER div 3 = NUMBER / 3 then
output NUMBER
end if
end if
end loop
Outline one difference between a bubble sort algorithm and a selection sort algorithm.
Outline what is meant by a sorting algorithm.
Construct a trace table for the following algorithm.
K = 1
N = 1
M = 2
loop while K < 5
output(N,M)
K = K + 1
N = N + 2
M = M * 2
end loop