1.  Choose the correct statement about the IComparer interface in C# ?


The IComparer is in System.Collections.Generic
It defines a generic form of Compare()
only a
Both a & b


Answer

 Option

IComparer is in System.Collections.Generic. It defines a generic form of Compare(),which is shown here: int Compare(T x, T y).It works the same as its non-generic relative: returning greater than zero if x is greater than y, less than zero if x is less than y, and zero if the two values are equal.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  Choose the correct statement about the IComparer interface in C# ?


The IComparer interface is in System.Collections
It defines a method called Compare(), which compares the values of two objects
Both a & b
none of the mentioned


Answer

 Option

The IComparer interface is in System.Collections. It defines a method called Compare(), which compares the values of two objects. It is shown here: int Compare(object x, object y) . It returns greater than zero if x is greater than y, less than zero if x is less than y, and zero if the two values are equal.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  What will be the output of given code snippet ?
static void Main()
{
int[] nums = { 1, 2, 3, 4, 5 };
Console.Write(‘’Original order: ‘’);
foreach(int i in nums)
Console.Write(i + ‘’ ‘’);
Array.Reverse(nums);
Console.Write(‘’Reversed order: ‘’);
foreach(int i in nums)
Console.Write(i + ‘’ ‘’);
Console.WriteLine();
}


Run time error
5, 4, 3, 2, 1
Compile time error
None of the mentioned


Answer

 Option

Reverse built in method() of array class is used to reverse the given array.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  If a is an array of 5 integers then which of the following is the correct way to increase its size to 10 elements ?


int[ ] a = new int[5];
int[ ] a = new int[10];

int[ ] a = int[5];
int[ ] a = int[10];

int[ ] a = new int[5];
a.Length = 10 ;

int[ ] a = new int[5];
a = new int[10];


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  Which of the following statements is correct about the array declaration given below ?
int [ ] [ ] [ ] intMyArr = new int [2] [ ] [ ];


intMyArr refers to a 2-D jagged array containing 2 rows.
intMyArr refers to a 2-D jagged array containing 3 rows.
intMyArr refers to a 3-D jagged array containing 2 2-D jagged arrays.
intMyArr refers to a 3-D jagged array containing three 2-D jagged arrays.


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report