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:
Verified
Q1: Which of the following statements are correct
Q2: How many enumerators will exist if four
Q3: In which of the following collections is
Q4: Which of the following statements are correct
Q6: Which of the following statements is incorrect
Q7: Which of the following statements are correct
Q8: Suppose a Generic class called SortObjects is
Q9: What is a delegate?
A)A strongly typed function
Q10: Which of the following is included in
Q11: Which of the following is true about
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents