Home / C# Programming / Arrays - C# :: Discussion

Discussion :: Arrays - C#

  1. Which of the following is the correct way to define and initialise an array of 4 integers?

    1.  int[] a = {25, 30, 40, 5};
    2.  int[] a;
       a = new int[3];
       a[0] = 25; 
       a[1] = 30;
       a[2] = 40; 
       a[3] = 5;
    3.  int[] a;
       a = new int{25, 30, 40, 5};
    4.  int[] a;
       a = new int[4]{25, 30, 40, 5};
    5.   int[] a;
        a = new int[4]; 
        a[0] = 25; 
        a[1] = 30; 
        a[2] = 40; 
        a[3] = 5;

  2. A.

    1, 2

    B.

    3, 4

    C.

    1, 4, 5

    D.

    2, 4, 5

    E.

    2, 5

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment