Microsoft Exam Questions

Which line of code should you insert at line 08?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You write the following code segment. (Line numbers are included for reference only.)

01 DataTable dt = new DataTable();
02 dt.Columns.Add("number");
03 dt.Columns.Add("string");
04 dt.Rows.Add(1, "3");
05 dt.Rows.Add(2, "2");
06 dt.Rows.Add(3, "1");
07 var result = from p in dt.AsEnumerable()
08
09 foreach (var number in result) {
10 Console.Write(number.ToString());
11 }

You need to display the string "321".

Which line of code should you insert at line 08?

A.
orderby p["number"] select p["string"];

B.
orderby p["string"] ascending select p["string"];

C.
orderby p["string"] descending select p["number"];

D.
orderby p["number"] descending select p["string"];