R

Ram Sharma • 193.86K Points
Coach

Q. Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A');
q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);

  • (A) IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • (B) IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • (C) IEnumerator e; e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • (D) IEnumerator e; e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • Correct Answer - Option(A)
  • Views: 152
  • Filed under category C#

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics