Which data structure is based on the Last In First Out (LIFO) principle?

  • A. a) Tree
  • B. b) Linked List
  • C. c) Stack
  • D. d) Queue
Correct Answer: C. c) Stack
Explanation:

LIFO means the last element added to the stack is the first one to be removed.

Imagine a stack of plates. The last plate you put on the stack is the first one you take off.

This behavior is essential in many applications, such as function calls, expression evaluation, and backtracking algorithms.

Key operations of a stack:

Push: Adds an element to the top of the stack.

Pop: Removes the top element from the stack.

Peek: Returns the top element without removing it.

isEmpty: Checks if the stack is empty.

If you think there is any confusion in the given MCQs, you can comment below.

Follow us on WhatsApp

docmcqs.com is Pakistan's No.1 online platform for preparing for all types of exams including PPSC, FPSC, KPSC, SPSC, Ministry of Defence, and for one-paper MCQs. This includes Pedagogy MCQs, general knowledge MCQs, current affairs MCQs, and much more.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top