18
(Choose 1 answer)
Which of the following statements is correct considering the code below?
Stack<int> S = new Stack<int>(); //line 1 S.Push(1);//line 2
//line 3
//line 4
S.Push(2);S.Push(3);
Queue<int> Q = new Queue<int>(); //line 5
while(S.Count > 0){//line 6 //line 7
Q.Enqueue(S.Pop()); //line 8 //line 9 }
A. After executing the code, the tail (last) element in Queue Q will be 1.
B. After executing this code, Stack S will not be empty.
C. This code inserts elements into Queue Q without affecting Stack S.
D. Line 6 repeats forever since Stack S will always have elements.
Elt