ProgrammingModerate

A sorted list 1, 1, 2, 3, 3 has its duplicates removed by a loop that unlinks a node whose value equals the previous node's value. How many nodes remain?

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

Correct answer: C. 3

The distinct values are 1, 2 and 3, so three nodes remain after the duplicates are unlinked and freed.

More C Programming questions

Exams that ask this topic