FoMS Experts

News / Exam Questions

QUESTION, ANSWER, EXPLANATION

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

Exam Question MS-21-013 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

Refer to the exhibits! The Set Payload transformer's value is set to {'year': '2020'}. What message value should be added to the Logger component to output the message 'The year is 2020', without hard-coding 2020?

Answer

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

The correct answer to this question is B.

Explanation

First you should notice that the property "year" is a string, not an integer, which could be important in a case of concatenation. The answer A is wrong because of the dollar sign, which could be used only if you would want to access something from the global configuration file. Answer C is eliminated because of the usage of the mathematical addition operator "+". Answer D is the tricky one. It almost looks good, especially if you take into consideration that the property "year" is a string, which could easily lead you to the conclusion that this concatenation would make sense. Nevertheless, it is wrong, because the whole expression "The year is ++ payload.year" is written as a string and that is exactly what would be the output of the logger. Three eliminated answers lead us to the answer B as the correct one.

Register now