Bird
0
0

Given this Lambda function code in Python:

medium📝 Predict Output Q4 of 15
AWS - Lambda
Given this Lambda function code in Python:
def handler(event, context):
    return event['key'] * 2

What is the output if the event is {"key": 5}?
ANone
B25
CError: key not found
D10
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function logic

    The function returns the value of event['key'] multiplied by 2.
  2. Step 2: Calculate output for event {"key": 5}

    5 * 2 equals 10, so the function returns 10.
  3. Final Answer:

    10 -> Option D
  4. Quick Check:

    Output = 5 * 2 = 10 [OK]
Quick Trick: Multiply event['key'] by 2 to get output [OK]
Common Mistakes:
  • Assuming string concatenation instead of multiplication
  • Expecting error due to missing key
  • Returning None by mistake

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes