The strStates and strCapitals arrays are parallel arrays. If Illinois is stored in the second element in the strStates array, where is its capital (Springfield) stored?

[amp_mcq option1=”strCapitals(1)” option2=”strCapitals(2)” option3=”strCapitals(0)” option4=”strCapitals(3)” correct=”option2″]

The correct answer is B.

Parallel arrays are arrays that have the same number of elements and are indexed in the same way. In this case, the strStates array has 5 elements, and the strCapitals array also has 5 elements. Since Illinois is stored in the second element in the strStates array, its capital (Springfield) is stored in the second element in the strCapitals array, which is strCapitals(2).

Option A is incorrect because Springfield is not the first element in the strCapitals array.

Option C is incorrect because Springfield is not the third element in the strCapitals array.

Option D is incorrect because Springfield is not the zeroth element in the strCapitals array.

Exit mobile version