PrepAway - Latest Free Exam Questions & Answers

Which line of code should you add to display only the digits from the RegionCode field?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.You write the following code segment.
DataTable dt = new DataTable(“Customer”);
dt.Columns.Add(“ID”, typeof(Int32));
dt.Columns.Add(“State”, typeof(String));
dt.Columns.Add(“RegionCode”, typeof(String));
dt.Rows.Add(1, “WA”, “MT297EM”);
dt.Rows.Add(2, “CA”, “MT33SG”);
dt.Rows.Add(3, “NY”, “MT73229MP”);
var query = from c in dt.AsEnumerable() select c[“RegionCode”];
foreach (string rNum in query)
You need to display only the digits from the RegionCode field. Which line of code should you add?

PrepAway - Latest Free Exam Questions & Answers

A.
Console.WriteLine(rNum.Select(c => char.IsDigit(c)));

B.
Console.WriteLine(rNum.Select(c => char.IsDigit(c)?c:”));

C.
Console.WriteLine(rNum.Select(delegate(char c) { return char.IsDigit(c); }));

D.
Console.WriteLine(rNum.Select(delegate(char c, int p) { return p.CompareTo(c); }));


Leave a Reply