Which of the following principle does Array use?
(A). Linear data structure
(B). FIFO
(C). Hierarchical data structure
(D). None of these
Question’s Answer: Linear data structure
FIFO means first element added to the queue is the first one to be removed from queue.
Data Structure | Principle |
Array | linear data structure without an inherent ordering principle |
Stack | LIFO |
Queue | FIFO |
Linked List | linear data structure without an inherent ordering principle |
Tree | hierarchical data structure without an inherent ordering principle |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> using namespace std; int main() { int T4Tutorials_Array[5]; cout << "Please Enter 5 numbers: "<<endl; for(int i = 0; i < 5; i++) { cin >> T4Tutorials_Array[i]; } cout << "You entered: "<<endl; for(int i = 0; i < 5; i++) { cout << T4Tutorials_Array[i] << " "<<endl; } return 0; } |
Output
Please Enter 5 numbers:
3
4
5
7
1
You entered:
3
4
5
7
1