nerdexam
Microsoft

98-372 · Question #45

You are creating an application using .NET Framework 4.0. You need to use an ArrayList instance. By default, what is the initial capacity of the ArrayList instance?

The correct answer is A. 0. By default, the initial capacity of ArrayList is zero. ArrayList grows dynamically. The ArrayList class implements IList interface using an array. The size of an array is dynamically increased or decreased as per the requirements. The two important methods used in the ArrayList c

Understanding Data Types and Collections

Question

You are creating an application using .NET Framework 4.0. You need to use an ArrayList instance. By default, what is the initial capacity of the ArrayList instance?

Options

  • A0
  • B4
  • C2
  • D8

How the community answered

(48 responses)
  • A
    83% (40)
  • B
    2% (1)
  • C
    4% (2)
  • D
    10% (5)

Explanation

By default, the initial capacity of ArrayList is zero. ArrayList grows dynamically. The ArrayList class implements IList interface using an array. The size of an array is dynamically increased or decreased as per the requirements. The two important methods used in the ArrayList class are as follows: Add(): It adds an object to the end of the ArrayList. Remove(): It removes an object from the ArrayList. The following code snippet displays the use of the ArrayList class: using System.Collections; public class MyArrayListClass public static void Main() ArrayList MyArray = new ArrayList(); MyArray.Add("Microsoft"); MyArray.Add("Corporation"); MyArray.Add("Limited"); PrintTheValues(MyArray); public static void PrintTheValues(IEnumerable MyList) { foreach(Object list in myList) Console.Write(list);

Topics

#ArrayList#initial capacity#collections#List

Community Discussion

No community discussion yet for this question.

Full 98-372 Practice