[amp_mcq option1=”assigns the value -13 to [2]” option2=”assigns the value 17 to n[2]” option3=”is wrong; it gives an error message” option4=”assigns the value 18 to n[2]” correct=”option2″]
The correct answer is: B. assigns the value 17 to n[2]
The statement int n[4] = {11, -13, 17, 105}; declares an array of 4 integers, and assigns the values 11, -13, 17, and 105 to the elements of the array, respectively. The element at index 2 is 17.
Option A is incorrect because it assigns the value -13 to the element at index 2, but the element at index 2 actually contains the value 17.
Option C is incorrect because the statement is valid and does not give an error message.
Option D is incorrect because the element at index 2 contains the value 17, not 18.