If the elements A, B, C and D are pushed onto a stack in this order, which element will be popped first?

Options

  • A. A
  • B. B
  • C. D
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. D

Detailed Explanation

Correct Answer: C. D

Explanation: Stack follows the LIFO (Last In, First Out) principle.

  • Push A, then B, then C, then D.
  • D is inserted last and becomes the top element.
  • Therefore, D will be removed first.