What will the value of the qty variable be after executing the Assign activity?

The following table is stored in a variable called "dt".

What will the value of the qty variable be after executing the Assign activity?

A . 5
B . 10
C . 80
D . null

Answer: C

Explanation:

The value of the qty variable will be 80 after executing the Assign activity. This is because the expression in the Assign activity is using the LINQ methods AsEnumerable, SkipWhile, and Item to access the data in the dt variable. The dt variable is a DataTable that contains the following data:

The AsEnumerable method converts the DataTable into an Enumerable collection of DataRow objects. The SkipWhile method skips the elements of the collection until the condition is false. The condition is a lambda expression that checks if the value of the Item column is equal to “mango”. The (0) indexer returns the first element of the collection after skipping. The Item method accesses the value of the Quantity column of the DataRow. The ToString method converts the value into a string. Therefore, the expression will skip the first three rows of the DataTable and return the value of the Quantity column of the fourth row, which is 80.

Reference: [DataTable.AsEnumerable Method], [Enumerable.SkipWhile Method], [DataRow.Item Property]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments