Difficulty: Easy
Correct Answer: 1 and 3 only
Explanation:
Introduction / Context:
This item probes understanding of jagged arrays (arrays of arrays) in C#. A jagged array 'int[][]' holds references to independent 1-D arrays. Rows can have different lengths and are separate objects on the heap, unlike a single rectangular block.
Given Data / Assumptions:
Concept / Approach:
Jagged arrays are not guaranteed to place each inner array in adjacent memory locations. The outer 'int[][]' variable refers to the outer array object whose elements are references to inner arrays. Access semantics make intMyArr[0] and intMyArr[1] the first and second inner arrays respectively.
Step-by-Step Solution:
Verification / Alternative check:
Print lengths: Console.WriteLine(intMyArr[0].Length); // 4, Console.WriteLine(intMyArr[1].Length); // 3. This confirms separate inner arrays.
Why Other Options Are Wrong:
Any option including (2), (4), or (5) is incorrect because those statements misrepresent jagged array memory layout or use an invalid index.
Common Pitfalls:
Confusing jagged arrays with rectangular arrays int[ , ] and assuming a contiguous 2-D memory layout.
Final Answer:
1 and 3 only
Discussion & Comments