Find and correct the error in each of the following program segments:
```
int[] b = new int[10];
2 for (int i = 0; i <= b.length; i++)
3 b[i] = 1;
```
Error: Referencing an array element outside the bounds of the array (b[10]).
Correction: Change the <= operator to <
You might also like to view...
Which of the following is NOT a total row option?
A) Pmt B) Avg C) Count D) Where
The loop for displaying "Beetlejuice" three times is ____.
A. Declare Numeric index = 1 While index < 3 Display "Beetlejuice" index = index + 1 End While B. Declare Numeric index = 0 While index == 3 Display "Beetlejuice" index = index + 1 End While C. Declare Numeric index = 0 While index <= 3 Display "Beetlejuice" index = index + 1 End While D. Declare Numeric index = 0 While index < 3 Display "Beetlejuice" index = index + 1 End While