5
Reply

What Will Be The Output Of The Following Code Snippet:public class Quiz{public static void Main(string[] args){int[] i = new int[0];Console.WriteLine(i[0]);}}a) 0 b) Nothing is printed as array is empty c) Compile time error d) IndexOutOfRangeException e) 1

Sandeep Soni

Sandeep Soni

6y
12.9k
1
Reply

    The answer is d) IndexOutofRangeException, the number of elements in the array is 0 and the program is trying to access the first element in the array.

    Index out of Range

    d) IndexOutOfRangeException

    b

    d.IndexOutOfRangeException. it will accept the first argument from index of "1".