AWS Lambda: Serverless Functions Quiz Quiz

Explore essential concepts of AWS Lambda, including event-driven execution, triggers, resource limits, and integration scenarios, to deepen your understanding of serverless functions. This quiz is designed for those looking to strengthen their knowledge of cloud-based compute services and serverless architecture.

  1. Execution Triggers

    Which of the following can directly trigger an AWS Lambda function to execute in response to an object upload?

    1. A virtual machine instance restarts
    2. A browser refreshes a webpage
    3. A user logs into a web application
    4. An object is uploaded to cloud storage

    Explanation: An object upload to cloud storage can be set as a trigger for a Lambda function, enabling event-driven automation. Logging into a web application does not automatically trigger Lambda unless configured via an authenticated backend. Refreshing a webpage only affects the client and doesn't invoke serverless functions by itself. Virtual machine restarts are unrelated to Lambda triggers and occur independently.

  2. Language Support

    Which programming language is NOT natively supported for writing AWS Lambda functions as of 2024?

    1. Go
    2. JavaScript
    3. Rust
    4. Python

    Explanation: Rust is not natively supported by the service, though Python, JavaScript, and Go are supported directly without extra configurations. You can run Rust code with custom runtimes, but it is not a built-in option. Python, JavaScript, and Go allow straightforward development and deployment with native support.

  3. Function Scalability

    How does AWS Lambda handle multiple simultaneous invocations of the same function?

    1. It rejects all but the first request
    2. It creates separate instances automatically
    3. It queues all requests until one finishes
    4. It runs only one instance ever

    Explanation: Lambda automatically creates separate instances to handle parallel invocations, allowing functions to scale with incoming events. Lambda does not queue all requests serially, making parallel execution possible. Rejecting all but the first request and running only one instance ever would severely limit scalability and are incorrect.

  4. Timeout Limits

    What is the maximum execution time a Lambda function can run before it is forcibly terminated?

    1. 5 hours
    2. 30 seconds
    3. 2 days
    4. 15 minutes

    Explanation: The service imposes a 15-minute timeout on function execution, after which the function is stopped. Five hours and two days are far beyond permissible limits for such short-lived functions. Thirty seconds is too restrictive since functions can perform more extended tasks within the allowed window.

  5. Deployment Packages

    What must be included in a deployment package when uploading code for a Lambda function that relies on external libraries?

    1. Just the external libraries
    2. The function code and all required libraries
    3. A database backup
    4. Only the function code file

    Explanation: A complete deployment package must include both the function code and all required external libraries to ensure the function runs correctly. Uploading only the function code will fail if dependencies are missing. Including just the libraries is not sufficient, and a database backup is unrelated to code execution requirements.

  6. Environment Variables

    Which is a recommended use for environment variables in AWS Lambda functions?

    1. Holding function logs
    2. Saving user passwords in plain text
    3. Hosting static website files
    4. Storing database connection strings

    Explanation: Environment variables are ideal for storing sensitive configuration data like database connection strings, which functions may need at runtime. Storing user passwords in plain text is insecure and not advised. Holding logs should be done in logging systems, not environment variables. Hosting static website files is unrelated to the purpose of environment variables.

  7. Function Integration

    In a serverless architecture, which service is commonly used to invoke Lambda functions via HTTP requests?

    1. DNS Resolver
    2. Cloud Monitor
    3. Object Lifecycle Manager
    4. API Gateway

    Explanation: API Gateway is designed to route HTTP requests to Lambda functions, enabling seamless serverless backend APIs. Cloud Monitor tracks resource metrics but doesn't handle HTTP invocation. DNS Resolver manages domain names and does not connect to Lambda, and Object Lifecycle Manager is related to storage management.

  8. Resource Limits

    What is the maximum amount of memory you can allocate to a Lambda function as of 2024?

    1. 32,768 MB
    2. 512 KB
    3. 1,024 GB
    4. 10,240 MB

    Explanation: The current memory allocation limit for Lambda functions is 10,240 MB, which balances between power and cost. 1,024 GB and 32,768 MB are much higher than supported, and 512 KB is far too low for typical workloads, making them incorrect.

  9. Cost Efficiency

    Which scenario best demonstrates the pay-per-use billing advantage of using Lambda functions?

    1. Manually scaling virtual machines up and down
    2. Purchasing fixed monthly server capacity
    3. Automatically processing image uploads only when new images arrive
    4. Running a server continuously regardless of demand

    Explanation: With Lambda, you incur costs only when functions are executed, such as processing uploads on demand. Running continuous servers, manually managing machine scaling, or paying for reserved capacity do not benefit from pay-per-use pricing. Automatic, event-driven execution models the main advantage.

  10. State Management

    Which statement about Lambda functions and state is accurate?

    1. Lambda functions can run indefinitely and store permanent data
    2. Lambda functions automatically save data between executions
    3. Lambda functions are stateless and do not retain data between executions
    4. Lambda functions always require local storage

    Explanation: Lambda functions are designed to be stateless, so data is not preserved after execution ends. They do not save data automatically, nor do they rely on local storage for state. Long execution and permanent data storage are not supported within the function environment.