UIPATH-SAIAV1 practice question 22 of 30

What does the following expression do? subTotalAdditions.Select(Function(field) CDec(documentFields(field))).ToList.Sum() + subtotal

Full set: 250 questions
Answer options
A: Sums up subtotal fields from the config file converted to CDec with the subtotal.
B: Sums up all the line amounts and converts the fields to CDec.
C: Sums up all the line amounts converted to CDec and the subtotal Correct answer
D: Sums up the subtotal to the total variable by converting it to CDec
Correct Answer:
C. Sums up all the line amounts converted to CDec and the subtotal
Explanation

The expression does the following: It uses the subTotalAdditions variable, which is a list of field names that represent the line amounts in the document. It uses the Select method to apply a function to each element of the list. The function takes a field name as an argument and returns the value of the corresponding document field converted to a decimal number using the CDec function. It uses the ToList method to convert the result of the Select method into a list of decimal numbers. It uses the Sum method to calculate the sum of the elements in the list. It adds the subtotal variable, which is another decimal number, to the sum. The expression returns the total amount of the document, which is the sum of all the line amounts and the subtotal.
Reference: VB.NET - Select Method VB.NET - CDec Function VB.NET - ToList Method [VB.NET - Sum Method]

Scroll to Top