PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing an application. The application 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 filteredEmployeeIds.
You have the following requirements:
Remove duplicate integers from the employeeIds array.
Sort the array in order from the highest value to the lowest value.
Remove the integer value stored in the employeeIdToRemove variable from the employeeIds array.
You need to create a LINQ query to meet the requirements.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:

3 Comments on “Which code segment should you use?

  1. Sarwarul Rizvi says:

    C

    sample code:
    int[] employeeIds = new int[] { 2, 3, 5, 2, 6 };
    var employeeIdToRemove = 6;
    int[] filter = employeeIds.Distinct().Where(x => x != employeeIdToRemove).OrderByDescending(x => x).ToArray();




    0



    0

Leave a Reply