ProgrammingModerate

A singly linked list of five nodes 1 -> 2 -> 3 -> 4 -> 5 has the node with value 3 unlinked and freed. How many nodes remain?

  1. A. 3
  2. B. 4
  3. C. 5
  4. D. 2

Correct answer: B. 4

Unlinking and freeing one node leaves 5 - 1 = 4 nodes; node 2 is simply relinked to node 4. 3 assumes a neighbour is freed too, and 2 confuses unlinking node 3 with truncating the list there.

More C Programming questions

Exams that ask this topic