ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 233 - MCD - Level 1 discussion

Report
Export

What DataWeave expression transforms the array a to the XML output?

A.
1. 1. trains: 2. 2. {( 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. 9. )}
Answers
A.
1. 1. trains: 2. 2. {( 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. 9. )}
B.
1. 1. trains: 2. 2. a map ((engId, index) -> 3. 3. train: { 4. 4. TrainNumber: engId 5. 5. 6. 6. } 7. 7. )
Answers
B.
1. 1. trains: 2. 2. a map ((engId, index) -> 3. 3. train: { 4. 4. TrainNumber: engId 5. 5. 6. 6. } 7. 7. )
C.
1. 1. {( 2. 2. trains: 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. )}
Answers
C.
1. 1. {( 2. 2. trains: 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. )}
D.
1. 1. { 2. 2. trains: 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. }
Answers
D.
1. 1. { 2. 2. trains: 3. 3. a map ((engId, index) -> 4. 4. train: { 5. 5. TrainNumber: engId 6. 6. 7. 7. } 8. 8. ) 9. }
Suggested answer: A

Explanation:

For such questions always look for Syntax:

I call it 'Wrap the Map'

trains:

{(

When mapping array elements (JSON or JAVA) to XML, wrap the map operations in {(..)}

-{ } are defining the object

-( ) are transforming each element in the array as a key/value pair

asked 18/09/2024
law ryan
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first