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

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
kingkayy
2 weeks, 6 days 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 1 times
...
milindkumar
2 months, 1 week ago
Selected Answer: A
Both options A and C are giving 80 as output. I tested in studio.
upvoted 1 times
...
milindkumar
2 months, 1 week ago
Selected Answer: A
A is correct as tested in studio.
upvoted 1 times
...
Choudayya
2 months, 1 week ago
Both options A and C are giving 80 as output. I tested in studio.
upvoted 1 times
...
Brandon00777
2 months, 1 week 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
2 months, 2 weeks 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 ...