Explore topic-wise MCQs in Attributes .

This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Attributes knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following is an ordered collection class? 1.Map 2.Stack 3.Queue 4.BitArray 5.HashTable

A. 2 and 3 only
B. 1 only
C. All of the above
D. 4 and 5 only
Answer» B. 1 only
2.

In which of the following collections is the Input/Output based on a key? 1.Map 2.Stack 3.BitArray 4.HashTable 5.SortedList

A. 2 and 3 only
B. 1 and 2 only
C. 4 and 5 only
D. 1, 2 and 3 only
Answer» D. 1, 2 and 3 only
3.

In which of the following collections is the Input/Output index-based? 1.Stack 2.Queue 3.BitArray 4.ArrayList 5.HashTable

A. 3 and 4 only
B. 1 and 2 only
C. 1, 2 and 5 only
D. 5 only
Answer» B. 1 and 2 only
4.

Which of the following is the correct way to access all elements of the Stack collection created using the C#.NET code snippet given below?

A. IEnumerable e; e = st.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
B. IEnumerator e; e = st.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
C. IEnumerator e; e = st.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
D. IEnumerator e; e = Stack.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
Answer» D. IEnumerator e; e = Stack.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
5.

Which of the following statements are correct about a HashTable collection?

A. 1 and 2 only
B. 1, 2 and 3 only
C. 4 and 5 only
D. 1, 4 and 5 only
Answer» E.
6.

Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr ?

A. arr.Count
B. arr.GrowSize
C. arr.MaxIndex
D. arr.Capacity
Answer» B. arr.GrowSize
7.

Which of the following is an ordered collection class?

A. 1 only
B. 2 and 3 only
C. 4 and 5 only
D. All of the above
Answer» C. 4 and 5 only
8.

Which of the following statements are correct about the Stack collection?

A. 1 and 2 only
B. 3 and 4 only
C. 1, 2 and 5 only
D. All of the above
Answer» D. All of the above
9.

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?

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);
Answer» B. IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
10.

In which of the following collections is the Input/Output based on a key?

A. 1 and 2 only
B. 2 and 3 only
C. 1, 2 and 3 only
D. 4 and 5 only
Answer» E.
11.

In which of the following collections is the Input/Output index-based?

A. 1 and 2 only
B. 3 and 4 only
C. 5 only
D. 1, 2 and 5 only
Answer» C. 5 only
12.

Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface?

A. 1 and 2 only
B. 1 and 3 and 4 only
C. 2 and 5 only
D. All of the above
Answer» C. 2 and 5 only