Bird
0
0

Given this Step Functions snippet, what will be the output after the Choice state if the input is {"value": 10}?

medium📝 Predict Output Q4 of 15
AWS - Serverless Architecture
Given this Step Functions snippet, what will be the output after the Choice state if the input is {"value": 10}?
{
  "StartAt": "CheckValue",
  "States": {
    "CheckValue": {
      "Type": "Choice",
      "Choices": [
        {"Variable": "$.value", "NumericGreaterThan": 5, "Next": "Greater"},
        {"Variable": "$.value", "NumericLessThanEquals": 5, "Next": "LessOrEqual"}
      ],
      "Default": "DefaultState"
    },
    "Greater": {"Type": "Pass", "End": true},
    "LessOrEqual": {"Type": "Pass", "End": true},
    "DefaultState": {"Type": "Pass", "End": true}
  }
}
AThe workflow goes to the 'Greater' state
BThe workflow goes to the 'LessOrEqual' state
CThe workflow goes to the 'DefaultState'
DThe workflow fails with an error
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the Choice state conditions

    The input value is 10, which is greater than 5, so the first choice condition matches.
  2. Step 2: Determine the next state

    Since the first condition matches, the workflow transitions to the 'Greater' state.
  3. Final Answer:

    The workflow goes to the 'Greater' state -> Option A
  4. Quick Check:

    Choice condition matched = Greater [OK]
Quick Trick: Choice state picks next based on input conditions [OK]
Common Mistakes:
  • Ignoring numeric comparison operators
  • Assuming DefaultState runs when a choice matches

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes