Consider the following code snippet:

    public class Employee
    {
        public string FirstName { get; set; }
        public string Designation { get; set; }

        public static List<Employee> GetEmployees()
        {
            return new List<Employee>
            {
                new Employee { FirstName="Charles", Designation = "Technical Architect" },
                new Employee { FirstName="Fleming", Designation = "Project Manager" },
                new Employee { FirstName="Anderson", Designation = "Team Leader" },
                new Employee { FirstName="Stephen", Designation = "Systems Engineer" }
            };
        }
        public override string ToString()
        {
            return string.Format("{0, -20}: {1, -20}", FirstName, Designation);
        }
    }
        static void Main(string[] args)
        {
            List<Employee> employees = Employee.GetEmployees();

            // Lambda Expression code goes here

            foreach (Employee employee in employees)
            {
                Console.WriteLine(employee);
            }
       }

Identify the proper Lambda Expression code to be written inside the Main() method, so that it produces the following output?

employees.Sort((first, second) => first.Designation.CompareTo(second.Designation));

employees.Sort((first, second) => second.Designation.CompareTo(first.Designation));

employees.Search((first, second) => first.Designation.CompareTo(second.Designation));

employees.Sort((first, second) => first.FirstName.CompareTo(second.FirstName));

Verified Answer
Correct Option - a

To get all Advanced CSharp Programming Assessment Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in