The function returns the value of 'key' from event, or 'default' if 'key' is missing.
Step 2: Check the event input
The event is an empty dictionary, so 'key' is not present, so it returns 'default'.
Final Answer:
"default" -> Option A
Quick Check:
Missing key returns default [OK]
Hint: Missing dict key returns default value [OK]
Common Mistakes:
Assuming missing key returns None
Expecting an error on missing key
Confusing key name with value
4. You created a Lambda function but it fails with a permissions error when invoked. What is the most likely cause?
medium
A. The deployment package is too large
B. The handler name is incorrect
C. The runtime is not supported
D. The Lambda execution role lacks necessary permissions
Solution
Step 1: Understand permissions in Lambda
Lambda functions need an IAM role with permissions to run and access resources.
Step 2: Identify cause of permissions error
A permissions error usually means the execution role is missing required permissions.
Final Answer:
The Lambda execution role lacks necessary permissions -> Option D
Quick Check:
Permissions error = missing IAM role rights [OK]
Hint: Check IAM role permissions for Lambda [OK]
Common Mistakes:
Blaming handler name for permissions error
Ignoring IAM role setup
Assuming runtime causes permissions error
5. You want to create a Lambda function that processes images uploaded to an S3 bucket. Which combination of settings is required to ensure the Lambda runs automatically when a new image is uploaded?
hard
A. Set Lambda runtime to Node.js and upload images directly to Lambda
B. Manually invoke Lambda after uploading images to S3
C. Set S3 event trigger on bucket for 'ObjectCreated' and assign Lambda execution role with S3 read permissions
D. Create an EC2 instance to monitor S3 and call Lambda
Solution
Step 1: Configure S3 event trigger
To run Lambda automatically on uploads, configure S3 to trigger Lambda on 'ObjectCreated' events.
Step 2: Assign correct IAM role permissions
Lambda needs an execution role with permissions to read from S3 to process images.
Final Answer:
Set S3 event trigger on bucket for 'ObjectCreated' and assign Lambda execution role with S3 read permissions -> Option C
Quick Check:
S3 trigger + IAM role = automatic Lambda run [OK]
Hint: Use S3 event triggers with proper IAM role [OK]
Common Mistakes:
Thinking manual invocation is automatic
Confusing runtime with event triggers
Using EC2 unnecessarily for Lambda triggers
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.