UiPath Automation Developer Professional v1 — Question 104
A developer has created a string array variable as shown below:
UserNames = {“Jane”, “Jack”, “Jill”, “John”}
Which expression should the developer use in a Log Message activity to print the elements of the array separated by the string “,”?
Answer options
- A. String.Join(“,”, UserNames)
- B. String.Concat(UserNames, “,”)
- C. String.Concat(“,”, UserNames)
- D. String.Join(UserNames, “,”)
Correct answer: A
Explanation
The correct answer is A, as String.Join(“,”, UserNames) correctly joins the elements of the array with a comma as a separator. Option B is incorrect because String.Concat does not insert separators between the elements. Options C and D are also incorrect because they either misplace the separator or do not correctly use the String.Join method.