Recursive Array Traversal Bounds
A recursive method is used to traverse an array. Which of the following is required to prevent the method from attempting to access an index outside the array’s boundaries?
A
By using a static counter that ignores the actual array length.
B
By removing the base case altogether.
C
By decrementing the index on each recursive call regardless of its current value.
D
By including a condition that checks if the current index is greater than or equal to the array’s length.
Question Leaderboard
Not enough data yet to show leaderboard.
