Index out of Range
Interviews5 answers
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
5 Answers
srinivas raoPosted Sep 3, 2019, 3:39 AM EDT
d) IndexOutOfRangeException
Sonu GuptaPosted Aug 19, 2019, 2:44 AM EDT
b
Rakesh EPosted Jun 24, 2019, 3:28 AM EDT
d.IndexOutOfRangeException. it will accept the first argument from index of "1".
siva bPosted Mar 12, 2019, 7:39 AM EDT
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.
Manoth KumarPosted Nov 26, 2018, 3:38 AM EST

