employer cover photo
employer logo
employer logo

Tata Consultancy Services

Part of Tata Group

Engaged employer

Tata Consultancy Services interview question

Can you explain the difference between a stack and a queue?

Interview Answer

Anonymous

20 Mar 2025

A stack follows the LIFO (Last In, First Out) principle, where the last element added is the first to be removed (e.g., a stack of plates). A queue follows the FIFO (First In, First Out) principle, where the first element added is the first to be removed (e.g., a line of people at a ticket counter).