Collection Classes Questions
Practice Collection Classes MCQs with answers and explanations. Page 1 of 1.
Category
C# Programming
Topic
Collection Classes
Page
1 / 1
Mode
Practice
Questions
Open any question to view the answer and explanation.
Hashtable in .NET: choose the correct combined statement about its characteristics.
Open
View answer
C#.NET Stack (non-generic): is the following mixed-type Push() usage valid?
Stack st = new Stack();
st.Push("hello");
st.Push(8.2);
st.Push(5);
st.Push('b');
st.Push(true);
Open
View answer
ArrayList in .NET: how do you get the current number of elements stored?
Open
View answer
Key-based I/O in .NET collections: which listed collections perform input/output based on a key?
Open
View answer
Which statements about the System.Collections.Stack collection are correct?
Open
View answer
C#.NET — ArrayList and IEnumerable/IEnumerator: identify the true statements about enumeration, thread-safety, and nested (inner) enumerator classes.
Statements:
1) The ArrayList class contains a nested enumerator class that implements IEnumerator.
2) An ArrayList collection cannot be accessed safely by multiple threads simultaneously (it is not synchronized by default).
3) The nested enumerator class of ArrayList can access members of the outer ArrayList class.
4) To access members of ArrayList from the nested class, it is necessary to pass a reference of the outer ArrayList to it.
5) Enumerators of ArrayList can directly manipulate (modify) the underlying array.
Open
View answer
Framework Class Library (FCL) collections — pick the correct statement about performance and mutability of elements stored in collection classes.
Open
View answer
ArrayList capacity growth — if Capacity is 4, what is the capacity after adding the 5th element?
Open
View answer
System.Collections — which of the following is NOT an interface defined in this namespace?
Open
View answer
Index-based Input/Output — in which of the following .NET collections are elements accessed by index?
Open
View answer
Ordered collection classes — which choices represent ordered collections in .NET?
Open
View answer
Hashtable — how do you check if a specific state name (key) like "Kerala" exists in the table of state→capital entries?
Open
View answer
Queue enumeration — choose the correct code to access all elements of a System.Collections.Queue instance.
Open
View answer
Stack enumeration — choose the correct code to access all elements of a System.Collections.Stack instance.
Open
View answer
Hashtable nullability rule — can a key be null and can a value be null?
Open
View answer
In .NET, an ArrayList is being enumerated by four threads at the same time. How many independent enumerator instances will exist concurrently for that single ArrayList object?
Open
View answer
Practice smarter
Solve a few questions daily and revisit weak topics regularly to improve accuracy.