Which code fragment should you add at line 15?

You are creating an ASP.NET application by using the .NET Framework 3.5.

Your application contains the following code segment. (Line numbers are included for reference only.)

01 DataTable table = new DataTable (“Produces”);

02 table.Columns.Add ( ” ProductName “, typeof (string));

03 . . .

04 table.Columns.Add (” UnitsInStock “, typeof ( int ));

05 DataSet ds – new DatoSet ();

06 ds.Tables.Add (table);

07 var productList = new[] {

08 new< ProductID = 1, ProductName = ” Chai “, Category = “Beverages”, UnitPrice – 18.0000M, UnitsInStock = 39>, new{ ProductID = 2, ProductName = “Chang”, Category = “Beverages”, UnitPrice = 19.0000M, UnitsInStock = 17), . . . )

09 foreach ( var x in productList ) {

10 table.Rows.Add (new object[]

11 { x.ProductID , x.ProductName , x.Category ,

12 x.UnitPrice , x.UnitsInStock ));

13 >

14 var products = ds.Tables [“Products”]. AsEnumerable ();

15 . . .

You need to return a list of 25 products that have a UnitsInStock value lower than 60. You also need to sort the list in ascending order by ProductName.

You need to return a list of 25 products that have a UnitsInStock value lower than 60. You also need to sort the list in ascending order by ProductName.

Which code fragment should you add at line 15?

You are creating an ASP.NET application by using the .NET Framework 3.5.

Your application contains the following code segment. (Line numbers are included for reference only.)

01 DataTable table = new DataTable (“Produces”);

02 table.Columns.Add ( ” ProductName “, typeof (string));

03 . . .

04 table.Columns.Add (” UnitsInStock “, typeof ( int ));

05 DataSet ds – new DatoSet ();

06 ds.Tables.Add (table);

07 var productList = new[] {

08 new< ProductID = 1, ProductName = ” Chai “, Category = “Beverages”, UnitPrice – 18.0000M, UnitsInStock = 39>, new{ ProductID = 2, ProductName = “Chang”, Category = “Beverages”, UnitPrice = 19.0000M, UnitsInStock = 17), . . . )

09 foreach ( var x in productList ) {

10 table.Rows.Add (new object[]

11 { x.ProductID , x.ProductName , x.Category ,

12 x.UnitPrice , x.UnitsInStock ));

13 >

14 var products = ds.Tables [“Products”]. AsEnumerable ();

15 . . .

You need to return a list of 25 products that have a UnitsInStock value lower than 60. You also need to sort the list in ascending order by ProductName.

You need to return a list of 25 products that have a UnitsInStock value lower than 60. You also need to sort the list in ascending order by ProductName.

Which code fragment should you add at line 15?

A.
vac productnames = produces
.Where(pr => pr-Field <decimal> (” UnitsInStock “) < 60) .Skip(25)
. OrderBy (p => p.Field <strlng> (” ProductName “));

B.
var productnames = produces
. SkipWhile (pr => pr.Field <decimal> (” UnitsInStock “) < 60) .Take(25)
. OrderBy (p => p .Field <string> (” ProductName “)) ;

C.
var productnames = products
.Where(pr => pr .Field <deciroal> (” UnitsInStock “) < 60) .Take(25)
. OrderBy (p => p.Field <string> (” ProductName “));

D.
var productnames = products
.Where(pr �> pr .Field <decimal> (” UnitsInStock “) < 60) .Take(25)
.Reverse();



Leave a Reply 0

Your email address will not be published. Required fields are marked *