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
Options
- Astack
- Btree
- Clist
- Dheap
How the community answered
(48 responses)- A71% (34)
- B17% (8)
- C4% (2)
- D8% (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.