Question 2


Multiple Choice

You are developing a card game for F54. The applicaton calls a method that returns an array of integers named employeeIds. You define an integer variable named employeeIdToRemove and assign a value to it. You declare an array named flteredEmployeeIds.
You have the following requirements:

  1. Remove duplicate integers from the employeeIds array.
  2. Sort the array in order from the highest value to the lowest value.
  3. Remove the integer value stored in the employeeIdToRemove variable from the employeeIds array.
  4. You need to create a LINQ query to meet the requirements.
Which code segment should you use?

  • A. int[] filterEmployeeIds = employeeIds.Where(value => value != employeeIdToRemove).OrderBy(x => x).ToArray();
  • B. int[] filterEmployeeIds = employeeIds.Where(value => value != employeeIdToRemove).OrderByDescending(x => x).ToArray();
  • C. int[] filterEmployeeIds = employeeIds.Distinct(value => value != employeeIdToRemove).OrderByDescending(x => x).ToArray();
  • D. int[] filterEmployeeIds = employeeIds.Distinct().OrderByDescending(x => x).ToArray();