Skip to content
Quiz · Arrays · lesson 2 of 9

Quiz — an index out of bounds

What happens when this program is compiled and run (lines separated by spaces)?

C#
int[] nums = [4, 8, 15];
for (int i = 1; i <= nums.Length; i++)
{
    Console.WriteLine(nums[i]);
}