nerdexam
Microsoft

70-515 · Question #56

You are developing an ASP.NET Web application. The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that compares strings without case sensitivity You add the…

The correct answer is C. return words.Orderby(a =>a.Length).ThenBy(a=> a, new. See the full explanation below for the reasoning.

Question

You are developing an ASP.NET Web application. The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that compares strings without case sensitivity You add the following method.(Line numbers are included for reference only.) 01 public IEnumerable<string>SortWords(string[] words) 02 { 03 04 } You need to sort the array by word length and then by alphabetic order, ignoring case. Which code segment should you add at line 03?

Options

  • Areturn words.Orderby(a => a, new
  • Breturn words.Orderby(a =>a.Length).Orderby(a => a,new
  • Creturn words.Orderby(a =>a.Length).ThenBy(a=> a, new
  • Dreturn words.Orderby(a =>a.Length.toString(), new

How the community answered

(44 responses)
  • A
    5% (2)
  • B
    5% (2)
  • C
    82% (36)
  • D
    9% (4)

Community Discussion

No community discussion yet for this question.

Full 70-515 Practice