ProgrammingHard

A circular singly linked list holds 1 -> 2 -> 3 -> back to 1. Starting at the head node, the program prints six consecutive values. What is the last value printed?

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

Correct answer: B. 3

The cycle repeats every three nodes, so the sequence is 1, 2, 3, 1, 2, 3 and the sixth value is 3.

More C Programming questions

Exams that ask this topic