C# Programming - Arrays - Discussion

Discussion :: Arrays - General Questions (Q.No.2)


Which of the following statements are correct about the C#.NET code snippet given below?

    int[] a = {11, 3, 5, 9, 4}; 
  1. The array elements are created on the stack.
  2. Refernce a is created on the stack.
  3. The array elements are created on the heap.
  4. On declaring the array a new array class is created which is derived from System.Array Class.
  5. Whether the array elements are stored in the stack or heap depends upon the size of the array.

[A]. 1, 2
[B]. 2, 3, 4
[C]. 2, 3, 5
[D]. 4, 5
[E]. None of these

Answer: Option B


No answer description available for this question.

Samaresh Maity said: (Aug 31, 2011)  
Array element are creted in a heap, it will created contigioues memory location.

Abcxyz said: (Jul 8, 2014)  

1] When an array is created it is derived from System.Array.
2] As it is of reference type it is stored on Heap memory dynamically.
3] & its reference is got stored stack.

So, Option B (2,3,4)

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.