C sharp output type question
Q. Choose the correct one.
int[] A = { 0, 2, 4, 5, 6, 8, 9 };
int[] B = { 1, 3, 5, 7, 8 };
IEnumerable nums = A.Except(B);
foreach (var n in nums)
{
Console.Write(n +” “);
}
- Published on 31 Aug 15a. 0, 2, 4, 5, 6, 8, 9
b. 1, 3, 5, 7, 8
c. 0 2 4 6 9
d. All of the above
ANSWER: 0 2 4 6 9
In the above example the answer will be C because Except extension method produces the set difference of two sequences. The result is a collection where the second array's elements are subtracted from the first array.