ProgrammingHard

A stack is kept as a linked list with the top at the head. Push A, push B, pop, push C, pop. Which element is on top at the end?

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

Correct answer: C. A

After the pops, the remaining element is A, which was pushed first and never removed.

More C Programming questions

Exams that ask this topic