What is printed by: int arr = new int; Console.WriteLine(arr);?
Correct answer B. 0
Explanation
When an array is created with new, every element is set to its type's default value. For int that is 0, so arr[1] prints 0. A string array would contain null elements and a bool array false. Accessing arr[3] would throw IndexOutOfRangeException, because valid indexes for a length-3 array are 0 to 2.
Answer checked How we write and check questions
Discussion