Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. What is the index of the first element accessed in the array when searching f

ID: 3566765 • Letter: 1

Question

1. What is the index of the first element accessed in the array when searching for the number 20?  

Only put in the integer for the index, not the value of the array.

2. What is the index of the second element accessed in the array when searching for the number 20?  

Only put in the integer for the index, not the value of the array.

3. What is the index of the third element accessed in the array when searching for the number 20?  

Only put in the integer for the index, not the value of the array.

4. What is the index of the fourth element accessed in the array when searching for the number 20?  

Only put in the integer for the index, not the value of the array.

5. Will the algorithm access another (the fifth) element in the array when searching for the number 20?  

Only put in the integer for the index, not the value of the array.

0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51

Explanation / Answer

1.

The correct answer is 0. The array index starts at 0. So, the first element in the array is accessed at index value 0, while searching the number 20.

2.

The correct answer is 1. The array index starts at 0. So, the second element in the array is accessed by incrementing the index value by 1. So, the index value becomes 1, while searching the number 20.

3.

The correct answer is 2. The array index starts at 0. So, the third element in the array is accessed by incrementing the index value by 1. So, the index value becomes 3, while searching the number 20.

4.

The correct answer is 3. The array index starts at 0. So, the fourth element in the array is accessed by incrementing the index value by 1. So, the index value becomes 3, while searching the number 20.

5.

The correct answer is 4. The array index starts at 0. So, the fifth element in the array is accessed by incrementing the index value by 1. So, the index value becomes 4, while searching the number 20.