FoMS Experts

News / Exam Questions

QUESTION, ANSWER, EXPLANATION

Exam Question MS-21-010 for MuleSoft Certified Developer (MCD) - Level 1

Exam Question MS-21-010 for MuleSoft Certified Developer (MCD) - Level 1
Share
FacebookGoogle plusLinkedInStumbleuponTwitter
FoMS24.2.2021

This question has been asked by one of our members and a similar question could most likely be on the exam. All answers have been verified by MuleSoft certified FoMS experts.

Question

What is the correct syntax for a Logger component to output a message with the content of a JSON Object payload?

Answer

A) The payload is: $(payload)
B) #["The payload is: " ++ payload]
C) The payload is: #[payload]
D) #["The payload is: " + payload]

The correct answer to this question is C.

Explanation

In answer A, syntax with a dollar sign is wrong and the payload is not accessible that way. In answer B, there is a problem with a concatenation operator "++", which is a binary operator between same(!) data types and in this case the concatenation of a string and an object would be tried, which would lead to an error. In Answer D, there is an error with an addition operator "+", which naturally can not be used here, since addition as a mathematical operation has not been asked for. That leaves us with a correct answer C.

Register now