UiPath Advanced RPA Developer (UiARD) — Question 41
A developer has two collections containing data:
1. A list of strings called listA that was initialized with 2 items
2. An array of strings called arrayB that was initialized with 2 items
How can both collections be combined into a single 4-item collection called results?
Answer options
- A. Use the Add To Collection activity with arrayB as the parameter
- B. Use the String.Join method with listA and arrayB as parameters
- C. Use a Multiple Assign activity to add each item from arrayB to listA
- D. Use a For Each activity to iterate through listA and add each item to arrayB
Correct answer: C
Explanation
The correct answer is C because using a Multiple Assign activity allows you to iterate through arrayB and add each item to listA, effectively combining both collections. Option A is incorrect as it only adds arrayB to an existing collection without combining elements. Option B is not suitable since String.Join creates a single string rather than merging the collections. Option D incorrectly suggests adding items from listA to arrayB instead of the other way around.