C# Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 2)
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.
1, 2
2, 3, 4
2, 3, 5
4, 5
None of these
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Samaresh Maity said:   1 decade ago
Array element are creted in a heap, it will created contigioues memory location.

AbcXyz said:   1 decade ago
See,

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:

Your comments will be displayed after verification.