L. P. with Microsoft C# - Level 3-Quiz-5
- the following are the concrete collections into which .NET has implemented collection interfaces.
- Array Lists
- Queues
- Stack
- Hashtables
- An enumerator gives you the ability to scroll through a collection to access all the individual elements of the collection using some sort of pre-defined techniques.
- IDictionary interface represents a set of keys and corresponding values.
- IList interface represents a set of objects that are accessed using an indexer, rather than a key/value.
- You want a collection that will store any type of object, allow dynamic, resizable arrays of those objects, and give you full random access to those elements. You should use An ArrayList.
- You have an ArrayList that you want to allow multiple threads to access simultaneously. Synchronize method is supported by the ArrayList to make the ArrayList thread-safe.
- If you create an ArrayList without specifying how many elements it is to hold, the capacity of the ArrayList will be 16 by default .
- Queue class works on a first in, first out basis.
- When you have a Queue full of elements, how do you look at the head element without removing it from the Queue?
Peek
- When you have a Queue full of elements, how do you return the first element in the Queue and remove it from the Queue at the same time?
Dequeue
- you would use A stack if you wanted to keep a trail of where you have been and keep track of a convenient way to get back.
- You have a Stack, and want to add an item to it. What member of the Stack class do you use to add the item?
Push
- You have a Hashtable, and you want to put additional elements into it. you use Add method to do this.
Permalink |
Comments (0) | Hits: 1056 | Time: 23:51:46