Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam UiADPv1 All Questions

View all questions & answers for the UiADPv1 exam

Exam UiADPv1 topic 1 question 57 discussion

Actual exam question from UiPath 's UiADPv1
Question #: 57
Topic #: 1
[All UiADPv1 Questions]

Considering that the attached table is stored in a variable called "dt":

Which LINQ query can be used to return the maximum total Quantity?

  • A. dt.AsEnumerable. Max(Function(x) Convert.ToInt32(x("Quantity").ToString))
  • B. dt.AsEnumerable. Max(Function(x) Convert.ToInt32(x("Quantity").ToString))("Item")
  • C. dt.AsEnumerable. GroupBy(Function(x) x("Item").ToString). Max(Function(x) x.Sum(Function(y) Convert.ToInt32(y("Quantity").ToString)))
  • D. dt.AsEnumerable. OrderByDescending(Function(x) Convert.ToInt32(x("Quantity").ToString)). First.Item("Quantity")
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Kartik_K
1 month, 1 week ago
C is the correct answer. This groups the table by the "Item" column, sums the "Quantity" for each group (item), and then finds the maximum sum. This is correct. A is incorrect because this returns the maximum individual "Quantity" value from the table, not the total per item.
upvoted 1 times
...
BenAndBen
4 months, 1 week ago
Selected Answer: A
Answer is A.
upvoted 1 times
...
kingkayy
7 months, 1 week ago
Selected Answer: C
The question is quite tricky. We are going to get 80 for both option A and C but here is why C is right. The question is asking for the maximum of the total quantities. In this case, option A just gives as the maximum individual quantity in the quantity column which is Kiwi giving 80. In the case of option C, which answers the question, it groups each of the quantity of items(apple, orange, mango, kiwi, pear). It goes ahead to sum them (apple - 10+5+12=27, orange-20, mango-5+15=20,kiwi=80,pear=1). It finds the maximum of the sums (27, 20, 20, 80, 1). In this case, 80 is the maximum of the total quantities.
upvoted 2 times
BenAndBen
4 months, 1 week ago
but the question is only ask for the maximum total quantity and it does not indicate to group and sum per item.
upvoted 1 times
...
...
milindkumar
8 months, 4 weeks ago
Selected Answer: A
Both options A and C are giving 80 as output. I tested in studio.
upvoted 1 times
...
milindkumar
8 months, 4 weeks ago
Selected Answer: A
A is correct as tested in studio.
upvoted 1 times
...
Choudayya
8 months, 4 weeks ago
Both options A and C are giving 80 as output. I tested in studio.
upvoted 1 times
...
Brandon00777
9 months ago
Correction: C seems to be correct, since the groupby function literally groups interrelated data and the sum function is self-explanatory.
upvoted 1 times
...
Brandon00777
9 months ago
The answer is A. I tested it in studio, it returned the value of 80. Which is the largest value in the "Quantity" column
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...