Arrays

Q1:
Which of the following is the correct way to obtain the number of elements present in the array given below?
    int[] intMyArr = {25, 30, 45, 15, 60};
  1. intMyArr.GetMax;
  2. intMyArr.Highest(0);
  3. intMyArr.GetUpperBound(0);
  4. intMyArr.Length;
  5. intMyArr.GetMaxElements(0);

A 1, 2

B 3, 4

C 3, 5

D 1, 5

E 4, 5

ANS:B - 3, 4

using System;
    
public class Test
{ 
   public static void Main()
   { 
        int[] intMyArr = { 25, 30, 45, 15, 60, 78, 99 };
        Console.WriteLine(intMyArr.Length);
        Console.WriteLine(intMyArr.GetUpperBound(0)+1);
   } 
}
/* 
Output : 
7 
7 
*/



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.