Exam MCD-Level-1 Topic 5 Question 154 Discussion

Actual exam question for MuleSoft's MCD-Level-1 exam
Question #: 154
Topic #: 5
What is the correct syntax to define and call a function in Database?

Suggested Answer: A Vote an answer

Keyword to ad function in Dataweave transformation is fun. Hence option 2 and 4 are invalid. Also parameters needs to be passed exactly in same order as defined in function definition. Hence correct answer is' fun addKV( object: Object, key: String, value: Any) = object ++ {(key):(value)}
---
addKV ( {"hello': "world"}, "hola", "mundo" )
MuleSoft Documentation Reference : https://docs.mulesoft.com/mule-runtime/4.3/dataweave-functions DataWeave Function Definition Syntax To define a function in DataWeave use the following syntax:
fun myFunction(param1, param2, ...) = <code to execute>
The fun keyword starts the definition of a function.
myFunction is the name you define for the function.
Function names must be valid identifiers.
(param1, param2, ... , paramn) represents the parameters that your function accepts.
You can specify from zero to any number of parameters, separated by commas (,) and enclosed in parentheses.
The = sign marks the beginning of the code block to execute when the function is called.
<code to execute> represents the actual code that you define for your function.

by Nina at Sep 29, 2026, 06:12 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
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.

0
0
0
10