Multiple choice

A stack is a linear data structure in which data is stored and retrieved in a _____.

  1. Last Out First In (LOFI)

  2. Last In First Out (LIFO)

  3. First In First Out (FIFO)

  4. Last In Last Out (LILO)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A stack follows the Last In First Out (LIFO) principle, where the last element added is the first one removed. This is analogous to a stack of plates where you can only add or remove from the top. Options like FIFO (queue) or LILO don't apply to stacks.