Multiple choice technology programming languages

A stack follows

  1. FIFO

  2. LIFO

  3. both (a) and (b)

  4. None of the above

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

A stack follows LIFO (Last In, First Out) - the last element pushed onto the stack is the first one popped off. This is like a stack of plates where you add and remove from the top. FIFO describes a queue, not a stack.

AI explanation

A stack is a Last-In-First-Out (LIFO) data structure: the most recently pushed element is the first one popped, like a stack of plates. This is fundamental — push and pop operations both act on the same end (the top). FIFO (First-In-First-Out) describes a queue instead, where elements are removed in the order they were added, which is the opposite behavior. Since a stack cannot simultaneously be FIFO and LIFO, 'both (a) and (b)' is wrong, and since LIFO is correct, 'None of the above' is also wrong.