What is the advantage of using 2D jagged array over 2D rectangular array?
A. Easy initialization of elements
B. Allows unlimited elements as well as rows which had ‘0’ or are empty in nature
C. All of the mentioned
D. None of the mentioned
Answer:B
What is the advantage of using 2D jagged array over 2D rectangular array?
A. Easy initialization of elements B. Allows unlimited elements as well as rows which had ‘0’ or are empty in nature C. All of the mentioned D. None of the mentioned
Explanation: In many applications where 2 dimensional arrays are used,not all rows need to have all the elements i.e they are sparse.Many rows have 0 elements.In such cases it is better to use 2D jagged arrays as they allow unequal number of elements in each row and also allow for empty rows.