Mule 4 Exam QuestionsBrowse all questions from this exam

Mule 4 Exam - Question 101


Refer to the exhibits.

Exam Mule 4 Question 101Exam Mule 4 Question 101

What payload and quantity are logged at the end of the main flow?

Show Answer
Correct Answer: C

The payload processed in the 'For Each' scope does not change outside the scope, hence it remains [1,2,3,4]. The variable 'quantity' starts at 10 and is incremented by 1 during each iteration of the 'For Each' loop. Since the array has four elements, the variable is incremented four times, resulting in a final value of 14. Therefore, the logged payload and quantity are [[1,2,3,4], 14].

Discussion

10 comments
Sign in to comment
Aaish
Sep 29, 2021

C is the correct answer. updated Variable are accessible after for each scope

almoraima
Sep 28, 2021

B is correct

pgarciar
Sep 29, 2021

C is correct. The variable is updated in the for each.

chaitind
Nov 18, 2021

yes, i have implemented on anypoint studio .

Zumo
Nov 29, 2021

B is not Correct. C is the correct Answer. INFO 2021-05-29 16:38:38,378 [[MuleRuntime].uber.46: [batchprocessingtest].q101-flow.CPU_LITE @5014e812] [processor: q101-flow/processors/4; event: 36b4db91-c06e-11eb-bcd9-40b89a99be08] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: [[1, 2, 3, 4], 14]

Ella_Z
Mar 3, 2022

I tested in Mule4, C is correct Please, why for each are cant change the payload ? [ "a", "b", "c", "d" ], 14 ]

BankZenith
Sep 19, 2022

C is correct , in for each payload is not changed but var can be changed.

RahulJain464Option: C
Feb 10, 2023

variables can be incremented in for each but payload is not affected in it

awsuser1
Feb 28, 2022

B is correct answer. INFO 2021-08-29 20:48:45,037 [[MuleRuntime].uber.01: [foreach].foreachFlow.CPU_LITE @742deb8f] [processor: foreachFlow/processors/3; event: 1e8b1a20-0902-11ec-b498-a0c589d689a8] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: [[1, 2, 3, 4], 10]

miguel_romero
Jun 15, 2022

C is the correct

HonestSeeker
Jul 26, 2023

Logic of why C is correct: a. For Each does not modify the current payload. The output payload is the same as the input. b. The variable value keeps incrementing per iteration and is available outside the For each scope.

Maddy_123
Sep 14, 2023

Answer is C [[1, 2, 3, 4], 14]

[Removed]Option: C
Jul 25, 2024

C. [[1,2,3,4], 14] - Because for-each scope DOESN'T MODIFY the payload!!!