Difficulty: Easy
Correct Answer: 2
Explanation:
Introduction / Context:
This tests your knowledge of array indexing and the GetUpperBound method. In a 1-D array of length N, valid indices are 0..N-1, and GetUpperBound(0) returns N-1.
Given Data / Assumptions:
Concept / Approach:
For any 1-D array arr of length L, arr.GetUpperBound(0) equals L - 1. Here L = 3, so the highest valid index is 2. Values like 3, 4, 7, or 9 are element values or lengths, not the upper index bound.
Step-by-Step Solution:
Verification / Alternative check:
Printing a[1].Length yields 3; confirming upper bound must be 2.
Why Other Options Are Wrong:
They confuse value, length, or an off-by-one index with the correct upper bound.
Common Pitfalls:
Off-by-one errors when thinking about 0-based indexing.
Final Answer:
2
Discussion & Comments