Question: You have created an array using val. Can you change the value of any element of the array?and why or why not?

  1. Yes, the reference to the array is immutable, so the location that the array points to is immutable. The values in the array are mutable.
  2. The 0th element is immutable and cannot be modified. All other elements can be modified.
  3. Yes, val does not make arrays immutable.
  4. No, val makes the array and values of the array immutable.

Answer: The correct answer of the above question is Option A:Yes, the reference to the array is immutable, so the location that the array points to is immutable. The values in the array are mutable.