A stack follows
-
FIFO
-
LIFO
-
both (a) and (b)
-
None of the above
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.
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.