C# Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 6)
6.
Which of the following is the correct output of the C#.NET code snippet given below?
int[ , , ] a = new int[ 3, 2, 3 ];
Console.WriteLine(a.Length);
Discussion:
11 comments Page 1 of 2.
Sum said:
9 years ago
3D array means 3 dimensional you can see the question in the square braces two commas is there that's the reason its called 3 dimesion array and 18 is the answer simply multiplied.
(1)
Yakesh said:
1 decade ago
1) Here length method gives the capacity of an array or no. Of elements it can store.
2) 3 arrays every array with 6 elements (2 by 3 array). Two rows and three columns.
2) 3 arrays every array with 6 elements (2 by 3 array). Two rows and three columns.
Mr. Az said:
1 decade ago
Well, its because; it is a 3D array with dimensions 3,2,3 so simply its get multiplied 3*2*3 = 18 i.e: Option C.
Note: In C# int requires 4 bytes of memory.
Note: In C# int requires 4 bytes of memory.
(1)
Avdhut said:
1 decade ago
It is 3d array so total 9 element so every element take 2 byte size because it is int type array so answer is 18.
Moinak said:
1 decade ago
3 arrays and if every array has 6 elements the total number of elements = 3*6 = 18. I think this is the answer.
Yash said:
10 years ago
I am not getting this at all. Can anyone please explain how 3D array looks like and how come its 18?
(1)
Nik said:
1 decade ago
It is third dimension array right?
Then how can we decide it's length as 18?
Then how can we decide it's length as 18?
Mot said:
1 decade ago
How the length is 18 ? I m not getting.
Neha said:
1 decade ago
How's it will be 18?
Prem said:
7 years ago
The answer is 4.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers