Which of the following data structures follows this rule?
undefined
-
Tree
-
Stack
-
Queue
-
String
-
Set
C
Correct answer
Explanation
A queue is a First In First Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed.