Unit 6: B2 Programming
Topic 6.2: Data structures Questions
Practice 20 exam-style questions for IB Computer Science Topic 6.2. Review the question stems below, then unlock the full Question Bank to access markschemes, model answers, and AI grading.
1Construct5 marks
2026
A cinema uses a two-dimensional list, sold, with 30 rows and 20 columns, where True means the seat has been sold. Construct a Python function quietestRow() that accepts sold and outputs the row in which the fewest seats were sold.
Assume only one row matches.
Markscheme and model answer locked
Unlock Question2Construct5 marks
2026
A cinema uses a two-dimensional array, sold, with 30 rows and 20 columns, where true means the seat has been sold. Construct a Java method quietestRow() that accepts sold and outputs the row in which the fewest seats were sold.
Assume only one row matches.
Markscheme and model answer locked
Unlock Question3Explain3 marks
2026
A gym stores its members' names and phone numbers in two separate one-dimensional structures, where a member's name and number share the same index.
Explain why indexed structures have been chosen to hold this data instead of a separate variable for each member.
Markscheme and model answer locked
Unlock Question4Construct3 marks
2023
A list ages holds the ages of the players in a team. Write a Python program that outputs their average age. Do not use sum().
Markscheme and model answer locked
Unlock Question5Describe4 marks
2018
A fixed-size array holds the names of 20 club members in alphabetical order, followed by empty slots. Describe how one member could be removed so that no gap is left in the array.
Markscheme and model answer locked
Unlock Question6Construct3 marks
2023
An int array ages holds the ages of the players in a team. Write a Java program that outputs their average age.
Markscheme and model answer locked
Unlock Question7Explain3 marks
2026
Explain why array indices commonly start at zero.
Markscheme and model answer locked
Unlock Question8Identify3 marks
2018
A Python program stores the songs in a playlist in a list. Identify three characteristics of a Python list.
Markscheme and model answer locked
Unlock Question9Identify3 marks
2018
A seat-booking program stores a theatre's seats in a two-dimensional array. Identify three characteristics of a two-dimensional array.
Markscheme and model answer locked
Unlock Question10Describe2 marks
2024
Describe what happens when an item is removed from the middle of a dynamic list.
Markscheme and model answer locked
Unlock Question11Determine2 marks
2014
An array B holds 2, 4, 6, 8, 10 at indexes 0 to 4. Every element at an even index is set to 0. Determine the contents of B afterwards.
Markscheme and model answer locked
Unlock Question12Draw2 marks
2014
An array SEATS of size 5 is empty. These steps run: 12 is stored at index 0, 7 at index 1 and 19 at index 2; then the value at index 0 is removed and every later value moves down one place. Draw the array after the steps run, showing each index.
Markscheme and model answer locked
Unlock Question13Determine1 mark
2025
An array PRICES holds 4.50, 2.00, 7.25 and 3.00 at indexes 0 to 3. Determine the value of PRICES[2].
Markscheme and model answer locked
Unlock Question14Determine2 marks
2014
An array H holds the heights 150, 171, 148 and 160 at indexes 0 to 3. The tallest and the shortest heights change places. Determine the contents of H afterwards.
Markscheme and model answer locked
Unlock Question15Draw2 marks
2014
An array STOCK of size 4 holds 3, 0, 5, 2 at indexes 0 to 3. A loop adds 10 to every element that is 0, then the element at index 3 is doubled. Draw the array afterwards, showing each index.
Markscheme and model answer locked
Unlock Question16Deduce2 marks
2014
An algorithm visits every element of an array of daily step counts and adds 1 to a counter whenever an element is greater than the one before it. Deduce the purpose of the algorithm.
Markscheme and model answer locked
Unlock Question17Construct5 marks
2026
An array a holds n numbers. Write Java that counts how many of them are greater than a value x, and outputs the count.
Markscheme and model answer locked
Unlock Question18Construct6 marks
2026
Lists team and other hold the scores of a netball team and its opponents in each game (same index, same game). The team won at least one game. Write Python code that outputs the team's largest winning margin.
Markscheme and model answer locked
Unlock Question19Construct4 marks
2026
Int arrays us and them hold the points of a rugby team and its opponents in each match (same index). The competition awards 4 points for a win, 2 for a draw and 0 for a loss. Write Java code that outputs the team's total.
Markscheme and model answer locked
Unlock Question20Sketch2 marks
2027
A canteen stacks trays numbered as they are washed. Using a stack with push, pop, peek and isEmpty, sketch the stack that results from: push(11), push(12), pop(), push(13), push(14), peek(), push(15), pop(). Clearly indicate the top of the stack.
Markscheme and model answer locked
Unlock QuestionReady to practice Topic 6.2?
Get instant AI feedback on your answers, view detailed markschemes, and track your progress across all IB Computer Science topics.
Start Practising Now