Bird
0
0

What is wrong with this Lambda function code?

medium📝 Debug Q7 of 15
AWS - Lambda
What is wrong with this Lambda function code?
def handler(event, context):
    return event['value'] / 0
ADivision by zero causes runtime error
BMissing context parameter
CEvent parameter is not a dictionary
DReturn statement syntax error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the return statement

    The function divides event['value'] by zero, which is not allowed.
  2. Step 2: Identify the error type

    Division by zero causes a runtime error (ZeroDivisionError).
  3. Final Answer:

    Division by zero causes runtime error -> Option A
  4. Quick Check:

    Division by zero = runtime error [OK]
Quick Trick: Never divide by zero in code [OK]
Common Mistakes:
  • Ignoring division by zero errors
  • Assuming missing parameters cause error
  • Thinking return syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes