Practice B2.4 Programming algorithms with authentic IB Computer Science (First Exam 2027) 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.
Define what is meant by an "algorithm" in computer science.
Describe the five essential characteristics that define a well-formed algorithm.
A teacher wants to create an algorithm to calculate class averages. Explain why having a finite number of steps and producing a definite output are crucial characteristics for this algorithm.
Define what is meant by "dynamic programming" in algorithm design.
Explain how dynamic programming differs from simple recursion and describe the key techniques used to improve efficiency.
The Fibonacci sequence (where each number is the sum of the two preceding ones) can be calculated using both simple recursion and dynamic programming. Compare the efficiency of these approaches for calculating the 40th Fibonacci number.
Define what is meant by a "searching algorithm".
Distinguish between linear search and binary search in terms of their requirements and search strategy.
An online store has a product database with 100,000 items sorted by product ID. A customer searches for a specific product ID. Explain why binary search would be significantly more efficient than linear search for this scenario.
State what is meant by "algorithm optimization" in programming.
Describe different levels at which algorithms can be optimized and explain the trade-offs involved in optimization decisions.
A weather prediction system processes meteorological data every hour. The current algorithm takes 45 minutes to complete but uses minimal memory. A new algorithm takes 10 minutes but requires 5 times more memory. Analyse the optimization considerations for this scenario.
Define what is meant by "Big O notation" in algorithm analysis.
Compare the efficiency of O(1), O(n), and O(n²) algorithms as the input size increases.
A social media platform needs to search through user posts. With 1 million users, explain why choosing an O(log n) search algorithm instead of an O(n) algorithm would be beneficial.
State what is meant by "recursion" in programming algorithms.
Describe the essential components required for a recursive algorithm to function correctly.
The calculation of factorial (n! = n × (n-1) × (n-2) × ... × 1) can be solved recursively. Explain why a base case is critical for a recursive factorial algorithm and what would happen without it.
Define what is meant by "divide and conquer" algorithm strategy.
Explain the three main phases of divide and conquer algorithms and describe how they work together to solve problems.
Merge sort uses a divide and conquer approach to sort arrays. Describe how this strategy makes merge sort more efficient than simple comparison-based sorting methods.
State what is meant by "greedy algorithms" in computer science.
Describe the characteristics of problems that are well-suited for greedy algorithm approaches and explain potential limitations of this strategy.
A cashier needs to give change using the fewest number of coins possible from denominations of 25¢, 10¢, 5¢, and 1¢. Explain how a greedy algorithm would solve this problem and why it works optimally for this scenario.
State what is meant by "algorithmic efficiency" in programming.
Explain the difference between time complexity and space complexity, providing examples of when each would be a primary concern.
Two algorithms solve the same problem: Algorithm A processes 1000 records in 2 seconds, Algorithm B processes the same records in 10 seconds but uses half the memory. Analyse the trade-offs between these algorithms and suggest when each might be preferred.
State what is meant by a "sorting algorithm".
Compare bubble sort and merge sort in terms of their approach to sorting and typical performance characteristics.
A library system needs to sort 50,000 book records by title for display. Justify which type of sorting algorithm would be more appropriate and explain the reasoning behind your choice.