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};
- The array elements are created on the stack.
- Refernce a is created on the stack.
- The array elements are created on the heap.
- On declaring the array a new array class is created which is derived from System.Array Class.
- Whether the array elements are stored in the stack or heap depends upon the size of the array.
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)
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:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers