MCD-LEVEL-1 practice question 13 of 30
Correct answer is {customerID}. Reference: https://docs.mulesoft.com/http-connector/1.5/http-listener-ref A function named toUpper needs to be defined that accepts a string named userName and returns the string in uppercase. What is the correct DW code to define the toUpper function?
Full set: 235 questionsIn DataWeave 2.0, custom functions are declared using the fun keyword. The correct syntax requires the fun keyword, followed by the function name, its parameters enclosed in parentheses, an equals sign (=), and finally the expression body. Therefore, fun toUpper(userName) = upper(userName) is the syntactically correct way to define a function that accepts a string and converts it to uppercase.
A: The var keyword is used to declare variables, not functions, and the -> operator is used for lambda expressions, not standard function definitions. C: The -> operator is incorrect for standard function definitions; an equals sign (=) must be used to assign the expression body to the function. D: The var keyword is strictly used to declare variables, whereas the fun keyword is required to declare custom functions.
MuleSoft Official Documentation: DataWeave Language -> DataWeave Scripts -> "Define Functions" (Section: Using the fun keyword).
Keep practicing
Take the free MCD-LEVEL-1 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other MCD-LEVEL-1 practice questions
- Question 3A Mule flow has three Set Variable transformers. What global data structure can be used t…
- Question 7A web client submits a request to http://localhost:8081?accountType=personal. The query p…
- Question 8What statement is a part of MuleSoft's description of an application network?
- Question 9A Scatter-Gather processes three separate HTTP requests. Each request returns a Mule even…
- Question 12Which file is used to define the interface contract to invoke a web service implemented a…
- Question 14An SLA based policy has been enabled in API Manager. What is the next step to configure t…
