← IB Computer Science

Data structures: IB Computer Science practice

Stacks, queues, linked lists and trees. 5 questions in the style of the IB Computer Science exam.

Sample questions

What does this program print?

stack = []
for item in ["a", "b", "c"]:
    stack.append(item)
print(stack.pop())
stack.append("d")
print(stack[-1], len(stack))
out = []
while stack:
    out.append(stack.pop())
print(" ".join(out))