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

Exam MCD - Level 1 All Questions

View all questions & answers for the MCD - Level 1 exam

Exam MCD - Level 1 topic 1 question 86 discussion

Actual exam question from Mulesoft's MCD - Level 1
Question #: 86
Topic #: 1
[All MCD - Level 1 Questions]

Refer to the exhibit.

What DataWeave expression transforms the conductorIds array to the XML output?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: D

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
pgarciar
Highly Voted 3 years, 8 months ago
B is correct
upvoted 16 times
...
Zumo
Highly Voted 3 years, 6 months ago
Option D gives below Error in Runtime. ""Trying to output second root, <trains>, while writing Xml at ." evaluating expression: "%dw 2.0 output application/xml var conductorIds=[592,251] --- trains: conductorIds map ( (engId, index) -> train: { engineerId: engId } ) ------------------------------------------- So the Correct Answer would be Option B.
upvoted 7 times
Empire
2 years, 7 months ago
yes bro you are right.. even i also tried this expression : var conductorIds=[592,251] --- trains: conductorIds map ( (engId, index) -> train: { engineerId: engId } ) i am getting error.. so, i tried this .. trains: {( conductorIds map ( (engId, index) -> train: { engineerId: engId } ) )} it is working fine ... correct option is "B"....
upvoted 1 times
...
...
ExamDev
Most Recent 10 months, 1 week ago
The correct answer is B: Tested on the anypoint studio output application/xml var conductorIds=[592,251] --- trains: { (conductorIds map ( (engId, index) -> train: { engineerId: engId } )) }
upvoted 1 times
...
Gaurav_9412
1 year, 4 months ago
B is correct %dw 2.0 var conductorIds=[10,30] output application/xml // imports modules::Utility // fun productcategory(itemId : Number,productcategory :String) = // "PC-"++ productcategory ++ (itemId as String) import dw::core::Strings --- // payload map (( key, index) -> ) // trains :{ // conductorIds map ((item,index)-> train:{ // }) // } // typeOf(payload) // { 'plural': Strings::pluralize("box") } trains :{ (conductorIds map ((item, index) -> { 'train' : { "engineerId":item, }})) }
upvoted 1 times
...
miguel_romero
2 years, 11 months ago
B is correct
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 ...