nerdexam
Microsoft

98-372 · Question #54

You are creating an application using .NET Framework 4.0. You need to use a first-in, first- out collection in the application. Which of the following is a first-in, first-out collection?

The correct answer is D. Queue. The Queue class is a first-in, first-out collection. The Queue is a data structure that stores a object in such a manner that the object inserted first is the first to come out. The queue is also called first in first out (FIFO) list. The two important methods used in the queue c

Understanding Data Types and Collections

Question

You are creating an application using .NET Framework 4.0. You need to use a first-in, first- out collection in the application. Which of the following is a first-in, first-out collection?

Options

  • AList
  • BLinkListNode <T>
  • CStack
  • DQueue

How the community answered

(21 responses)
  • A
    5% (1)
  • C
    10% (2)
  • D
    86% (18)

Explanation

The Queue class is a first-in, first-out collection. The Queue is a data structure that stores a object in such a manner that the object inserted first is the first to come out. The queue is also called first in first out (FIFO) list. The two important methods used in the queue class are as follows: Enqueue(): Inserts an object in the queue. Dequeue(): Removes an object from the queue. The following code snippet displays the use of the Queue class: using System.Collections; public class SamplesQueue public static void Main() Queue MyQueue = new Queue(); MyQueue.Enqueue("Microsoft"); MyQueue.Enqueue("Corporation"); MyQueue.Enqueue("Limited"); PrintTheValues(myqueue); public static void PrintTheValues(IEnumerable MyCollection) { foreach (Object list in MyCollection) Console.Write(list); Answer: C is incorrect. The Stack collection is a last-in, first-out collection. Answer: A is incorrect. The List class does not support ordered retrieval. Answer: B is incorrect. The LinkListNode <T> class represents a node in a LinkedList. Each element of the LinkedList <T> class is a LinkedListNode. It contains a value, a reference, a The following example creates a new LinkedListNode of type String: LinkedListNode<String> lln = new LinkedListNode<String>( "Company" );

Topics

#Queue#FIFO#Stack#collections

Community Discussion

No community discussion yet for this question.

Full 98-372 Practice