Bird
0
0

Which of the following is the correct way to define an AWS Lambda function handler in Node.js?

easy📝 Syntax Q3 of 15
AWS - Lambda
Which of the following is the correct way to define an AWS Lambda function handler in Node.js?
Afunction handler(event, context) { console.log('Hello'); }
Bdef handler(event, context): return 'Hello World'
Cexports.handler = async (event) => { return 'Hello World'; };
Dlambda_handler(event, context) => { return 'Hello'; }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the language

    Node.js Lambda handlers use exports.handler or module.exports.handler.
  2. Step 2: Check syntax

    exports.handler = async (event) => { return 'Hello World'; }; uses correct async arrow function syntax for Node.js Lambda.
  3. Final Answer:

    exports.handler = async (event) => { return 'Hello World'; }; -> Option C
  4. Quick Check:

    Node.js Lambda handlers export a function named 'handler' [OK]
Quick Trick: Node.js Lambda handlers use exports.handler [OK]
Common Mistakes:
  • Using Python syntax in Node.js Lambda
  • Incorrect function export syntax
  • Missing async keyword when needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes