Friday, 16 December 2011

34.How many enumerators will exist if four threads are simultaneously working on anArrayList object?

A.1
B.3
C.2
D.4
Answer: Option D

33.Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface?

1.The ArrayList class contains an inner class that implements theIEnumerator interface.
2.An ArrayList Collection cannot be accessed simultaneously by different threads.
3.The inner class of ArrayList can access ArrayList class's members.
4.To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it.
5.Enumerator's of ArrayList Collection can manipulate the array.
A.1 and 2 only
B.1 and 3 and 4 only
C.2 and 5 only
D.All of the above
E.None of the above
Answer: Option B

32.What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
    class SampleProgram
    {
        static void Main(string[ ] args)
        {
            int i, j;
            int[ , ] arr = new int[ 2, 2 ];
            for(i = 0; i < 2; ++i)
            {
                for(j = 0; j < 2; ++j)
                {
                    arr[i, j] = i * 17 + i * 17;
                    Console.Write(arr[ i, j ] + " ");
                }
            }
        }
    }
}
A.0 0 34 34
B.0 0 17 17
C.0 0 0 0
D.17 17 0 0
E.34 34 0 0
Answer: Option A

31.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
Answer: Option B

30.Which of the following is the correct output of the C#.NET code snippet given below?

int[][] a = new int[2][];
    a[0] = n ew int[4]{6, 1, 4, 3};
    a[1] = new int[3]{9, 2, 7};
    Console.WriteLine(a[1].GetUpperBound(0));
A.3   
B.4
C.7
D.9
E.2       
Answer: Option E

29.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;
3.a = new int[3];
4.a[0] = 25;
5.a[1] = 30;
6.a[2] = 40;
7.a[3] = 5;
8.int[] a;
9.a = new int{25, 30, 40, 5};
10.int[] a;
11.a = new int[4]{25, 30, 40, 5};
12.int[] a;
13.a = new int[4];
14.a[0] = 25;
15.a[1] = 30;
16.a[2] = 40;
17.a[3] = 5;
A.1, 2
B.3, 4
C.1, 4, 5
D.2, 4, 5
E.5, 5
Answer: Option C

28.Which of the following statements is correct about the C#.NET code snippet given below?

int[] intMyArr = {11, 3, 5, 9, 4};
A.intMyArr is a reference to an object of System.Array Class.
B.intMyArr is a reference to an object of a class that the compiler derives fromSystem.Array Class.
C.intMyArr is a reference to an array of integers.
D.intMyArr is a reference to an object created on the stack.
E.intMyArr is a reference to the array created on the stack.
Answer: Option B