Question: The following commands below create a Queue and then add and remove items from it. After the last line of these commands, which of the
The following commands below create a Queue and then add and remove items from it. After the last line of these commands, which of the options below show the correct order of the values inside of q?
Queueq = new Queue (); q.Enqueue(3); q.Enqueue(5); q.Enqueue(9); q.Enqueue(q.Dequeue()); q.Enqueue(2); q.Enqueue(4); q.Enqueue(q.Dequeue()); q.Enqueue(q.Dequeue()); q.Enqueue(1); q.Enqueue(8);
OPTIONS
| 3, 5, 9, 2, 4, 1, 8 | |
| 3, 5, 9, 1, 8, 2, 4 | |
| 5, 9, 2, 4, 1, 8, 3 | |
| 3, 2, 4, 5, 9, 1, 8 | |
| 2, 4, 1, 8, 3, 5, 9 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
