nerdexam
Python_Institute

PCEP-30-02 · Question #7

A data structure described as LIFO is actually a:

The correct answer is A. stack. LIFO stands for Last In, First Out, which is the defining characteristic of a stack (A) - the last element pushed onto the stack is the first one popped off, like a stack of plates. The distractors are wrong for these reasons: B. Tree - a hierarchical structure with…

Question

A data structure described as LIFO is actually a:

Options

  • Astack
  • Btree
  • Clist
  • Dheap

How the community answered

(48 responses)
  • A
    71% (34)
  • B
    17% (8)
  • C
    4% (2)
  • D
    8% (4)

Explanation

LIFO stands for Last In, First Out, which is the defining characteristic of a stack (A) - the last element pushed onto the stack is the first one popped off, like a stack of plates.

The distractors are wrong for these reasons:

  • B. Tree - a hierarchical structure with parent/child nodes; has no inherent ordering policy like LIFO.
  • C. List - a sequential collection that supports arbitrary insertion/removal at any position, not constrained to LIFO.
  • D. Heap - a priority-based tree structure where elements are removed by priority, not by insertion order.

Memory tip: Think of a stack of pancakes - you always add and remove from the top. The last pancake placed is the first one eaten: Last In, First Out = stack.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice