Skip to content
ExamSpine

B2.2 Data structures: notes and practice

B2.2 covers storing many values: one and two dimensional arrays or lists, stacks, queues, dictionaries and the difference between static and dynamic structures.

Paper 2SL and HL46 practice questions

What you need to know

Our summary of the topic in our own words, not the IB guide.

  • Distinguish static from dynamic data structures
  • Compare static and dynamic structures on memory use, flexibility and access speed
  • Choose a static or dynamic structure for a described scenario and justify it
  • Create, index, update and iterate over a one-dimensional array or list
  • Write code that searches or accumulates over a list
  • Create and traverse a two-dimensional array or list, including by row and by column
  • Trace code that manipulates an array or list and state the final contents
  • Explain the last in, first out behaviour of a stack and name its operations
  • Trace a sequence of push and pop operations and state the stack contents at the end
  • Identify a problem that a stack solves naturally and explain why
  • Explain the first in, first out behaviour of a queue and name its operations
  • Trace a sequence of enqueue and dequeue operations and state the queue contents at the end
  • Identify a problem that a queue solves naturally and explain why
  • Use a dictionary or map to store and retrieve values by key

Learn it

Practice questions

Original questions written for the 2027 course, marked as you go. Easiest first.

Exam tips for B2.2

  • Draw the structure after each operation when tracing a stack or a queue.
  • For a 2D list, be clear whether you loop by row first or by column first.
  • Explain why a stack suits undo or bracket matching and a queue suits waiting in order.

Updated 24 October 2026. Topic codes are used as labels. Everything on this page is written by ExamSpine and is not endorsed by the IB.