I'm going to go out on a limb here and answer this one, however there is no correct answer for this broad question.
We first have to ask, what makes an array multidimensional?
I'm going to assume that your interviewer considers a multidimensional array one with a fixed size (as you've shown in your question), where it cannot be considered "jagged". According to Microsoft, a jagged array in C# is as follows:
The elements of a jagged array can be of different dimensions and sizes.
In Java, a multidimensional array is simply an array, where each element is also an array. These arrays must be defined with a fixed size in order for elements to be indexed within them, but jagged arrays can be of different sizes, as stated above.
An ArrayList
is backed by an array; however, the array expands when a certain number of elements are added to it. For this reason, the ArrayList
could become jagged, and could be considered not to be multidimensional any longer.
Edit: After rereading everything over a few times, I'm sure that your interviewer was just trying to confuse you. It honestly doesn't make sense for one data type (an array) to be multidimensional, and another data type (an ArrayList
that uses an array) to not be multidimensional.
>` is a 2D array: you can visualise it as existing in two dimensions. If you wanted to be explicit about non-jaggedness, the word 'matrix' conveys that meaning much better. This was intentionally designed to trip you up.
– Michael May 09 '17 at 10:05