PrepAway - Latest Free Exam Questions & Answers

Which line of code should you add?

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("Strings");
dt = new DataTable();
dt.Columns.Add("Strings");
dt.Rows.Add("A-B");
dt.Rows.Add("C-D");
var c = from Strings in dt.AsEnumerable()
select Strings[0];
int count = 0;

You need to ensure that the value of the count variable is 4.

Which line of code should you add?

PrepAway - Latest Free Exam Questions & Answers

A.
count = c.Select(str => ((string)str).Split(‘-‘)).Count();

B.
count = c.SelectMany(str => ((string)str).Split(‘-‘)).Count();

C.
count = c.Select(str => ((string)str).Replace(‘-‘, ‘n’)).Count();

D.
count = c.SelectMany(str => ((string)str).Replace(‘-‘,’n’)).Count();


Leave a Reply