Back to course room

1DV505 · Programming and Data Structures · Autumn 2026

Choose and trace a data structure

5-minute practice · 3 questions·Original Coursfy practice
1. A queue starts empty. Which value does the last dequeue return?
enqueue(A)
enqueue(B)
dequeue()
enqueue(C)
dequeue()
2. A stack starts empty. Which value does the last pop return?
push(4)
push(9)
pop()
push(2)
pop()
3. A nonempty singly linked list has n nodes and only a head pointer. How does this loop’s running time grow?
node = head
while node.next != null:
    node = node.next