What will be the output of the following C# code? | Question 19

69. What will be the output of the following C# code?

using System;

namespace MyApplication {
  class Program {
    static void Main(string[] args) {
      int[,] ARR = {{1,2},{3,4}};
      Console.WriteLine(ARR.GetLength(0)+","+ARR.GetLength(1));
    }
  }
}
  1. 4,4
  2. 2,2
  3. Compilation Error
  4. Runtime Error

Answer: B) 2,2

Explanation:

The above code will print the length of the of the first and second rows of the above two-dimensional array.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.