DVA-C02 Sample Questions

DVA-C02 Sample Questions & Answers

Writing code against AWS services like Lambda carries the biggest share, ahead of securing applications with the right authentication and encryption choices, getting deployment artifacts ready and tested, and fixing or speeding up how applications run.

Launch the full DVA-C02 simulator →

Showing 10 of 20 free samples.

  1. Question 1Advanced

    Development with AWS Services · Fault-tolerant design patterns

    True or False: When using an Amazon SQS FIFO (First-In-First-Out) queue as a trigger for an AWS Lambda function, if the function fails to process a batch of messages, the entire batch becomes visible again for reprocessing after the visibility timeout expires, and the order of messages within that batch is preserved for the next processing attempt.

    Show answer & explanation

    Correct answer: A

    This statement is true. For SQS FIFO queues, if a Lambda function invocation returns an error without successfully processing any messages in the batch, all messages in that batch remain in the queue and become visible again after the visibility timeout. The Lambda service ensures that it will attempt to process the same batch of messages again while preserving their original order relative to other messages in the same message group.

  2. Question 2Intermediate

    Development with AWS Services · Writing code that interacts with AWS services by using APIs and AWS SDKs

    A developer is writing a Python script using Boto3 to list all objects in a versioned Amazon S3 bucket that contains over 1 million objects. The initial script uses the s3_client.list_objects_v2() method in a simple loop. During testing, the script is very slow and occasionally misses some objects. To improve performance and ensure all objects are retrieved, the developer decides to use a higher-level abstraction provided by Boto3. Which Boto3 feature should the developer use?

    Show answer & explanation

    Correct answer: C

    Many AWS API operations that return a list of items are paginated. Manually handling the pagination tokens (NextToken, NextContinuationToken, etc.) is error-prone. Boto3 Paginators provide a higher-level abstraction that automatically handles the logic of making multiple service calls to retrieve all results. For listing objects, get_paginator('list_object_versions') should be used for a versioned bucket.

  3. Question 3AdvancedSelect 2

    Troubleshooting and Optimization · Instrument code for observability

    A developer is instrumenting a Node.js application running on AWS Fargate to use AWS X-Ray for distributed tracing. The application makes calls to an Amazon DynamoDB table and publishes messages to an Amazon SNS topic. The developer has already configured the X-Ray daemon to run as a sidecar container in the Amazon ECS task definition.

    Which steps must the developer take within the application code to ensure that calls to DynamoDB and SNS are automatically traced as subsegments? (Select TWO)

    Show answer & explanation

    Correct answers: A, B

    The core X-Ray SDK library is required to create segments, subsegments, and interact with the X-Ray daemon. This is the foundational step for any X-Ray instrumentation in a Node.js application.

    To automatically trace downstream calls made with the AWS SDK, the SDK itself must be instrumented. The AWS X-Ray SDK for Node.js provides a captureAWS method that patches the AWS SDK to automatically create subsegments for each API call, including calls to DynamoDB and SNS.

  4. Question 4Beginner

    Development with AWS Services · Using data caching services

    A developer needs to store customer session data for a high-traffic e-commerce application running on Amazon EC2. The session data must be highly available and provide low-latency read and write access. The data also needs to expire automatically 24 hours after creation to keep the data store clean. Which service is the BEST choice for this use case?

    Show answer & explanation

    Correct answer: D

    Amazon ElastiCache for Redis is an in-memory data store that provides sub-millisecond latency for reads and writes, making it perfect for session management in high-traffic applications. Redis has built-in support for setting a time-to-live (TTL) on keys, which will automatically expire and evict the session data after the specified duration. This meets all the requirements with high performance and minimal management.

  5. Question 5Advanced

    Deployment · Deploying an application version by using deployment strategies

    A developer is building an application that will be deployed using a blue/green strategy on AWS Lambda. The developer is using AWS CodeDeploy to manage the traffic shifting between the old and new versions of a Lambda function. The developer needs to define the deployment steps in an appspec.yml file. The deployment should shift 10% of traffic to the new version, wait 5 minutes, and then shift the remaining 90% of traffic. Which AWS CodeDeploy deployment type should be specified in the AppSpec file?

    Show answer & explanation

    Correct answer: B

    The scenario describes a canary deployment, which is a type of linear deployment in AWS CodeDeploy. The Linear deployment type allows traffic to be shifted in increments with a specified interval between them. The developer would configure Type: Linear, StepPercentage: 10, and Interval: 5 (in minutes) to achieve the initial 10% shift. The Canary deployment type is a predefined linear deployment that shifts traffic in two increments.

  6. Question 6Intermediate

    Development with AWS Services · Amazon DynamoDB keys and indexing

    A developer is working with an Amazon DynamoDB table that has a large number of items. The developer needs to retrieve all items that match a specific value for a non-key attribute. The current approach uses a Scan operation, but this is consuming a large number of read capacity units (RCUs) and is slow. What is the MOST efficient way to retrieve these items?

    Show answer & explanation

    Correct answer: C

    A Scan operation always reads every item in a table, which is inefficient and costly for large tables. A Query operation is much more efficient as it directly accesses items based on a key. To query by a non-key attribute, a global secondary index (GSI) must be created with that attribute as its partition key. The application can then query the GSI, which is significantly faster and consumes fewer RCUs than a full table scan.

  7. Question 7Advanced

    Security · Implement encryption by using AWS services

    A developer has an AWS Lambda function that needs to access a secret stored in AWS Secrets Manager. The secret contains a database password. The Lambda function's execution role has been granted the secretsmanager:GetSecretValue permission. When the function is invoked, it fails with an 'Access Denied' error when trying to retrieve the secret. The secret is encrypted with a customer managed AWS KMS key. What is the MOST likely cause of this error?

    Show answer & explanation

    Correct answer: B

    When a secret in AWS Secrets Manager is encrypted with a customer managed KMS key, any principal (like a Lambda execution role) that needs to retrieve the secret's value needs two sets of permissions: secretsmanager:GetSecretValue on the secret itself, and kms:Decrypt on the KMS key used to encrypt the secret. The 'Access Denied' error in this scenario is most likely because the Lambda role is missing the kms:Decrypt permission in either its IAM policy or the KMS key's resource policy.

  8. Question 8Beginner

    Deployment · Implementing and deploying infrastructure as code (IaC) templates

    A developer is using the AWS CLI to deploy an AWS CloudFormation stack. The command fails with the error message: An error occurred (InsufficientCapabilitiesException) when calling the CreateStack operation: Requires capabilities : [CAPABILITY_IAM]. What does this error indicate about the CloudFormation template?

    Show answer & explanation

    Correct answer: C

    AWS CloudFormation requires you to acknowledge that a template might create IAM resources (such as IAM roles or users) that can modify permissions in your AWS account. This is a safety mechanism. To resolve the error, the developer must add the --capabilities CAPABILITY_IAM flag to the aws cloudformation create-stack or aws cloudformation deploy command. This explicitly acknowledges that the stack will create IAM resources.

  9. Question 9Intermediate

    Development with AWS Services · Writing code to use messaging services

    A development team is building a microservices application where services communicate asynchronously. One service, the OrderProcessor, needs to receive messages from multiple other services (e.g., PaymentService, InventoryService). The team wants to decouple these services so that producer services do not need to know about the consumer. The OrderProcessor should receive all messages in a single, durable queue. How should the developer design this architecture?

    Show answer & explanation

    Correct answer: B

    This architecture, known as the fanout pattern, is ideal for decoupling multiple producers from one or more consumers. The producer services only need to know about the single SNS topic endpoint. The SNS topic can then deliver messages to multiple subscribers. By subscribing an SQS queue to the topic, the messages become durable and can be processed asynchronously by the OrderProcessor. This decouples the services and provides a reliable messaging channel.

  10. Question 10Intermediate

    Development with AWS Services · Architectural patterns (orchestration)

    Case Study: E-commerce Order Processing Workflow

    A rapidly growing e-commerce company is re-architecting its monolithic order processing system into a serverless, microservices-based architecture on AWS. The goal is to improve scalability, reliability, and the speed of feature development. The company has identified several distinct steps in the order processing workflow that need to be orchestrated.

    The desired workflow is as follows: When a new order is placed, the system must first ValidateOrder. If validation is successful, it must concurrently ProcessPayment and UpdateInventory. Both of these concurrent tasks must complete successfully before the system proceeds to ShipOrder. If either ProcessPayment or UpdateInventory fails, a HandleFailure step must be executed, which notifies the support team and attempts to roll back any changes. The entire process should be traceable and have built-in error handling and retry logic.

    The development team consists of developers proficient in writing AWS Lambda functions for business logic. They want a solution that allows them to focus on the code for each step (e.g., ValidateOrder, ProcessPayment) without managing the complex state transitions, error handling, and parallel execution logic. The solution must provide a visual representation of the workflow for easier debugging and understanding.

    Which AWS service should the developer choose to orchestrate this multi-step, serverless workflow while meeting all the stated requirements?

    Show answer & explanation

    Correct answer: C

    AWS Step Functions is designed specifically for orchestrating multi-step workflows involving services like AWS Lambda. It allows developers to define the workflow logic, including sequential steps, parallel execution (Parallel state), error handling (Catch blocks), and retries, in a declarative JSON-based language (Amazon States Language). Step Functions manages the state transitions, provides a visual representation of the workflow execution in the console, and allows developers to focus solely on the business logic within their Lambda functions. This perfectly matches all the requirements of the case study.

Ready for the real thing?

The full DVA-C02 simulator has every exam-style question, timed mode, and instant scoring.