DVA-C02 · 32% of the exam
Development with AWS Services practice questions
10 free Development with AWS Services questions for the AWS Certified Developer – Associate (DVA-C02) exam, each with the correct answer and an explanation for every option.
What this domain covers
Writing code that uses AWS services: Lambda, API Gateway, DynamoDB, messaging and the SDKs, with the patterns developers use every day.
- Exam weight
- 32%
- On a real exam
- ≈ 21 questions
- In our bank
- 173 questions
Topics that come up most
- Lambda configuration, concurrency and event sources
- API Gateway stages, integrations and caching
- DynamoDB keys, indexes, queries vs scans
- SQS, SNS, Kinesis and Step Functions
- SDK retries, pagination and error handling
How to study it
Build one small serverless app end to end. Questions assume you've hit throttling, timeouts and partition-key choices yourself.
Sample Development with AWS Services questions
Try each one before opening the answer. Original questions written to the official exam objectives.
Question 1
A Lambda function calls GetItem and Query on a DynamoDB table whose items have many large attributes, but the function uses only three of them. The developer wants DynamoDB to return only those three attributes so the response payload sent to the function is smaller. What should the developer specify on the read requests?
- AA ProjectionExpression that names only the three attributes the function needs
- BThe ConsistentRead parameter set to false so that eventually consistent reads are used
- CA higher provisioned read capacity setting on the table and its indexes
- DA DynamoDB Streams view type of KEYS_ONLY enabled on the table
Show answer and explanation
Answer: A) A ProjectionExpression that names only the three attributes the function needs
A ProjectionExpression makes DynamoDB return only the attributes you name, which shrinks the response. Read capacity consumption doesn't change, because RCUs are based on the full item size.
- ACorrect. By default DynamoDB returns all attributes of an item. A projection expression limits the response to the attributes you name, which makes the payload smaller. It does not lower consumed read capacity, though: DynamoDB calculates capacity units from the full item size, not from the amount of data returned.
- BIncorrect. Eventually consistent reads use half the read capacity of strongly consistent reads, but they still return every attribute of the item. They don't change the size of the response payload.
- CIncorrect. More read capacity raises the available throughput. Each read still returns the whole item unless a projection expression is used.
- DIncorrect. A stream view type controls what goes into stream records for downstream consumers. It has no effect on the attributes that GetItem or Query return.
Question 2
A team wants an Amazon S3 bucket to publish a message to an Amazon SNS topic each time an object under the audit/ prefix is deleted, so that a separate audit service can react. Which configuration meets this requirement?
- AAn S3 event notification for s3:ObjectRemoved:* events, filtered on the audit/ prefix, with the SNS topic as its destination
- BAn S3 event notification for s3:ObjectCreated:* events, filtered on the audit/ prefix, with the SNS topic as its destination
- CAn S3 Lifecycle rule scoped to the audit/ prefix that expires objects and publishes each expiration to the SNS topic
- DAn SNS subscription filter policy on the topic that matches DeleteObject calls made against the audit/ prefix
Show answer and explanation
Answer: A) An S3 event notification for s3:ObjectRemoved:* events, filtered on the audit/ prefix, with the SNS topic as its destination
Configure an S3 event notification with the s3:ObjectRemoved:* event type and a prefix filter, and set the SNS topic as its destination. S3 publishes only the event types and key prefixes you specify.
- AS3 event notifications let you choose event types, including object removal events, and filter them by key prefix. SNS topics are a supported destination, so this sends only deletions under audit/ to the topic.
- BObjectCreated events fire when objects are added, not deleted. S3 sends notifications only for the event types you specify, so deletions wouldn't produce any messages.
- CA Lifecycle rule only manages transitions and expirations on a schedule. It has no SNS destination of its own, and it wouldn't capture deletions that users or applications make.
- DA subscription filter policy only filters messages that have already been published to the topic. S3 doesn't publish anything to the topic unless the bucket has a notification configuration for it.
Question 3
An Amazon Cognito user pool sends email through Amazon SES. A developer wants a Lambda function to set the subject and HTML body of the verification-code email sent after a user signs up, personalizing the text with the user's attributes. Which Lambda trigger should the developer configure?
- ACustom message trigger, returning emailSubject and emailMessage that include the codeParameter placeholder
- BPre sign-up trigger, returning the email subject and body alongside the autoConfirmUser flag
- CPost confirmation trigger, rewriting the verification email before Cognito delivers the code
- DPre token generation trigger, adding the subject and body as claims for Cognito to email
Show answer and explanation
Answer: A) Custom message trigger, returning emailSubject and emailMessage that include the codeParameter placeholder
The custom message trigger runs before Cognito sends verification, invitation and MFA messages. It can return a dynamic emailSubject and emailMessage (with SES/DEVELOPER email sending) as long as the codeParameter placeholder is included.
- ACognito invokes the custom message trigger before it sends verification, invitation and MFA messages (triggerSource CustomMessage_SignUp after sign-up). The function can return emailSubject and emailMessage, which must contain the codeParameter placeholder. These fields require EmailSendingAccount to be DEVELOPER, which is the SES setup described in the stem.
- BThe pre sign-up trigger runs before the user is created. Its response supports only autoConfirmUser, autoVerifyEmail and autoVerifyPhone, so it can't set message content.
- CPost confirmation runs only after the user has confirmed, so the verification code has already been sent. It can't change that message.
- DPre token generation changes claims in the ID and access tokens issued at sign-in. It has no part in building or sending verification emails.
Question 4
An S3 bucket holds about 400 million objects. A compliance team needs a file every week that lists each object's key, size, storage class, and server-side encryption status. The file must be written to a separate audit bucket. The solution must not add List request load to the source bucket and should need as little custom code as possible. Which solution meets these requirements?
- AConfigure an S3 Inventory report on the bucket with a weekly frequency and the audit bucket as the destination
- BEnable S3 Storage Lens on the account and export its weekly metrics to the audit bucket as a CSV file
- CEnable S3 server access logging on the bucket and deliver the access log files to the audit bucket
- DCreate an AWS CloudTrail trail that records S3 data events for the bucket and delivers them to the audit bucket
Show answer and explanation
Answer: A) Configure an S3 Inventory report on the bucket with a weekly frequency and the audit bucket as the destination
S3 Inventory is the scheduled, file-based alternative to the synchronous List APIs. It writes a daily or weekly list of objects with chosen metadata, such as size, storage class, and encryption status, to a destination bucket without adding List request load.
- ACorrect. S3 Inventory writes CSV, ORC, or Parquet files on a daily or weekly schedule to a destination bucket. Size, storage class, and encryption status are optional metadata fields you can include. Inventory doesn't use the List API operations and doesn't affect the bucket's request rate.
- BIncorrect. Storage Lens gives aggregated usage and activity metrics at the account, bucket, and prefix level. It doesn't produce a list of individual objects with their keys and per-object metadata.
- CIncorrect. Server access logs record the requests made to a bucket. They don't list every stored object, and objects that nobody accessed would never show up in them.
- DIncorrect. CloudTrail data events record object-level API activity such as GetObject and PutObject. They are an activity log, not a list of every object in the bucket with its metadata.
Question 5
An application needs a durable, ordered log of every change made to specific DynamoDB items, to feed a downstream analytics pipeline. Which DynamoDB feature provides this?
- ADynamoDB Streams
- BGlobal secondary indexes
- CDynamoDB Accelerator (DAX)
- DOn-demand backups
Show answer and explanation
Answer: A) DynamoDB Streams
- AStreams captures a time-ordered sequence of item-level modifications (inserts, updates, deletes) and retains them for 24 hours, letting downstream consumers like Lambda or Kinesis Data Streams process each change event.
- BGSIs provide alternate query access patterns on current data; they don't provide a change-event log for downstream processing.
- CDAX is a read-through cache for improving read latency; it doesn't capture a change log.
- DBackups are point-in-time snapshots for recovery, not a continuous, ordered stream of individual item-level changes.
Question 6
A single-page app on https://app.example.com calls a Lambda function URL. The developer set AllowOrigins to "*" in the function URL's CORS configuration. The function code also adds an Access-Control-Allow-Origin: * header to every response. Preflight OPTIONS requests succeed, but browsers reject GET responses with the error: "The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed." What should the developer do to fix this?
- ARemove the CORS headers from the function code and keep all CORS settings in the function URL configuration
- BChange the function URL's AuthType from NONE to AWS_IAM so that Lambda validates each cross-origin request
- CAdd OPTIONS to AllowMethods in the function URL's CORS configuration so that preflight responses include the header
- DDelete the function URL's CORS configuration and return the CORS headers only from the function code for GET requests
Show answer and explanation
Answer: A) Remove the CORS headers from the function code and keep all CORS settings in the function URL configuration
For non-preflight requests, a Lambda function URL returns both its configured CORS headers and any CORS headers the function returns, which can duplicate Access-Control-Allow-Origin. AWS recommends configuring CORS only on the function URL.
- ACorrect. For non-preflight requests such as GET, Lambda returns both the CORS headers configured on the function URL and any CORS headers the function returns, so the header is duplicated. AWS recommends putting all CORS settings on the function URL instead of adding them in the function response.
- BIncorrect. AuthType controls whether Lambda authenticates callers with IAM. It has nothing to do with how CORS response headers are merged, so the duplicate header would still be there.
- CIncorrect. Preflight requests already succeed, and for preflight requests the function URL's configured CORS headers take precedence anyway. The failure is on GET responses, where the header from the configuration and the header from the code are both returned.
- DIncorrect. This fixes the duplicate on GET but leaves preflight OPTIONS requests without any configured CORS handling, so the cross-origin flow can break. AWS recommends doing the opposite: configure CORS on the function URL and don't send the headers manually.
Question 7
A developer uses a standard (non-transactional) PutItem call to write a 2.3 KB item to a DynamoDB table in provisioned capacity mode. How many write capacity units (WCUs) does this single write consume?
- A3 WCUs, because the item size is rounded up to the next 1 KB
- B2.3 WCUs, because capacity is charged for the exact item size
- C1 WCU, because writes are measured in 4 KB units like reads
- D6 WCUs, because every write is performed as two underlying writes
Show answer and explanation
Answer: A) 3 WCUs, because the item size is rounded up to the next 1 KB
For writes, DynamoDB rounds item size up to the next 1 KB, and each 1 KB costs one WCU, so a 2.3 KB standard write uses 3 WCUs. Transactional writes would double this.
- ACorrect. One WCU covers one write of an item up to 1 KB. For writes, DynamoDB rounds the item size up to the next 1 KB multiple, so 2.3 KB counts as 3 KB, which is 3 WCUs.
- BIncorrect. DynamoDB does not use fractional write units for item size. It rounds the size up to the next 1 KB first and charges whole units.
- CIncorrect. The 4 KB unit applies to reads. Writes are measured in 1 KB units, so a 2.3 KB item needs more than one WCU.
- DIncorrect. Only transactional writes (TransactWriteItems) cost double, because they prepare and then commit. A standard PutItem of a 2.3 KB item uses 3 WCUs, not 6.
Question 8
A developer is building a mobile backend that exposes a GraphQL schema. Clients must receive real-time updates through GraphQL subscriptions when data changes. Queries and mutations must resolve directly against Amazon DynamoDB tables and AWS Lambda functions. The developer does not want to host or maintain a GraphQL server. Which solution meets these requirements?
- ACreate an AWS AppSync GraphQL API with DynamoDB and Lambda data sources
- BCreate an Amazon API Gateway WebSocket API with routes integrated with Lambda
- CCreate an Amazon API Gateway REST API that uses AWS service integrations with DynamoDB
- DCreate an Amazon API Gateway HTTP API that proxies to a Lambda function running a GraphQL library
Show answer and explanation
Answer: A) Create an AWS AppSync GraphQL API with DynamoDB and Lambda data sources
AWS AppSync is the managed GraphQL service. It provides built-in resolvers for data sources such as DynamoDB and Lambda, plus real-time subscriptions. API Gateway options would require custom GraphQL handling.
- AAppSync is a managed GraphQL service. It resolves fields against data sources such as DynamoDB and Lambda and delivers subscriptions over serverless WebSockets, so there's no GraphQL server to run.
- BWebSocket APIs provide two-way, real-time messaging. However, they have no GraphQL schema or resolver model, so the developer would have to write the GraphQL parsing and subscription handling themselves.
- CREST API service integrations can call DynamoDB directly, but they are resource and method based. They don't provide GraphQL schema resolution or subscription delivery.
- DThis setup is a self-managed GraphQL server that the developer must maintain, which the requirements rule out. HTTP APIs also don't provide GraphQL subscriptions.
Question 9
Two instances of an application can update the same Amazon DynamoDB item at the same time. To avoid lost updates, a developer adds a ConditionExpression to each UpdateItem request that checks the item's version attribute. How does DynamoDB handle these requests?
- AThe update is applied only if the item's current attributes satisfy the expression; otherwise the request fails
- BThe update is queued and retried automatically by DynamoDB until the expression evaluates to true
- CThe update consumes no write capacity units whenever the expression evaluates to false
- DThe item is locked against all other reads and writes until the conditional update completes
Show answer and explanation
Answer: A) The update is applied only if the item's current attributes satisfy the expression; otherwise the request fails
A ConditionExpression makes DynamoDB apply a write only when the item's current state matches the condition. Otherwise the write fails with ConditionalCheckFailedException, which allows optimistic locking that prevents lost updates.
- ACorrect. A conditional write succeeds only if the item's attributes meet the condition. Otherwise DynamoDB returns a ConditionalCheckFailedException, so a stale writer can't overwrite newer data.
- BIncorrect. DynamoDB doesn't queue or retry a failed conditional write. It returns ConditionalCheckFailedException, and the application decides what to do next.
- CIncorrect. When a ConditionExpression evaluates to false, DynamoDB still consumes write capacity. The amount depends on the size of the existing item, with a minimum of 1.
- DIncorrect. Conditional writes are optimistic. They check the condition against the latest version of the item when the write runs and don't hold locks that block other readers or writers.
Question 10
A deployment script calls the DynamoDB CreateTable API and then immediately writes seed items to the new table. The writes sometimes fail. The developer adds the SDK waiter waitUntilTableExists between the two steps. Why does this fix the problem?
- AIt polls the table's status until it is ACTIVE, because CreateTable returns while the table is still CREATING
- BIt retries the failed seed writes with exponential backoff whenever DynamoDB returns a throttling error
- CIt subscribes to a table-created event so DynamoDB pushes a notification to the client once the table exists
- DIt makes the original CreateTable request synchronous, so the API response returns only after creation finishes
Show answer and explanation
Answer: A) It polls the table's status until it is ACTIVE, because CreateTable returns while the table is still CREATING
DynamoDB CreateTable is asynchronous and returns while the table is still CREATING. A waiter polls until the table is ACTIVE, which prevents the race where writes happen before the table can accept them.
- ACreateTable is asynchronous. It returns right away with TableStatus CREATING, and reads and writes only work on an ACTIVE table. The waiter keeps checking the table until it reaches the desired state (or gives up), so the writes run only after the table is ready.
- BThat describes the SDK's built-in retry behavior for transient and throttling errors. A waiter doesn't retry your writes. It checks a resource's state before your code continues.
- CWaiters don't subscribe to events or receive push notifications. They repeatedly call a describe-style API until the resource reaches the target state or the waiter times out.
- DThe waiter doesn't change CreateTable, which still returns immediately with status CREATING. The waiter is a separate polling step that runs after CreateTable returns.
Development with AWS Services: FAQs
How much of the DVA-C02 exam is Development with AWS Services?
Development with AWS Services is 32% of the DVA-C02 exam by the official exam guide's weighting, which on a 65-question form works out to roughly 21 questions. The real exam's exact split varies by form.
What does the Development with AWS Services domain cover?
Writing code that uses AWS services: Lambda, API Gateway, DynamoDB, messaging and the SDKs, with the patterns developers use every day.
How should I study Development with AWS Services for DVA-C02?
Build one small serverless app end to end. Questions assume you've hit throttling, timeouts and partition-key choices yourself.
Where can I practise more Development with AWS Services questions?
This page has 10 free Development with AWS Services questions with answers. CertRidge's DVA-C02 question bank has 173 questions in this domain. Every practice exam result breaks your score down by domain, and Review Mode re-drills the questions you missed.
Other DVA-C02 domains
Also: 15 free questions across all domains, the DVA-C02 cheat sheet and the study guide.
Get Development with AWS Services exam-ready
The full DVA-C02 bank has 173 Development with AWS Services questions. Timed practice exams match the real exam's length and domain weights, every result shows your score per domain, and Review Mode re-drills the questions you missed.
Not affiliated with AWS; questions are original and never copied from the real exam.