Interviews - C# Corner

Sandeep Soni
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
By Sandeep Soni in .NET onNov 14 2018
  • Manoth Kumar
    Nov, 2018 26

    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.

    • 3
  • Sonu Gupta
    Aug, 2019 19

    d) IndexOutOfRangeException

    • 0
  • Rakesh E
    Jun, 2019 24

    b

    • 0
  • siva b
    Mar, 2019 12

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

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS