Development with AWS Services

Domain 1: Development with AWS Services

49 practice questions for Domain 1 of the AWS Certified Developer - Associate (DVA-C02) exam, which makes up 32% of its scored content. Your answers count towards one score and one timer for the whole exam.

Domain 1: Development with AWS Services

32% of scored content · 49 practice questions

1. A web application must let users upload files of up to 5 GB directly to Amazon S3 without the bytes passing through the application servers. Which solution meets these requirements?

Answer and explanation

Answer: C. A presigned URL grants time-limited scoped permission so the browser uploads straight to S3, and multipart upload handles objects of this size with retryable parts. Proxying through API Gateway is bounded by its payload limit and adds cost. Anonymous write permission allows anyone to upload arbitrary content. Forwarding through EC2 is exactly the traffic path the requirement excludes.

2. Messages relating to a single customer must be processed in order, while messages for different customers are processed concurrently. Which solution meets these requirements?

Answer and explanation

Answer: D. Ordering is guaranteed within a message group, so using the customer ID as the group ID serialises each customer while different groups process concurrently. A single group ID for everything serialises the whole queue and removes parallelism. A standard queue makes no ordering guarantee. SNS is a fan-out notification service and does not order messages.

3. A task must run once each day at 03:00 UTC and invoke an AWS Lambda function. Which solution meets these requirements?

Answer and explanation

Answer: B. EventBridge Scheduler triggers targets on cron or rate expressions with time zone support and at-least-once delivery. SQS delay queues cap at fifteen minutes. A function that sleeps would exceed the fifteen-minute execution limit and bill for idle time. Scheduled scaling adjusts Auto Scaling capacity and does not invoke Lambda.

4. An AWS Lambda function processes records from an Amazon Kinesis Data Stream. One malformed record fails repeatedly and blocks the shard. Which solution meets these requirements?

Answer and explanation

Answer: C. Kinesis event source mappings retry a failed batch until it succeeds or expires, so a retry limit with an on-failure destination moves the poison record aside and unblocks the shard. A longer timeout does not help a record that always fails. A larger batch ties more records to the failure. Provisioned concurrency addresses cold starts.

5. An application must publish an event that triggers different downstream actions depending on the event's content, without the publisher knowing which consumers exist. Which solution meets these requirements?

Answer and explanation

Answer: D. EventBridge matches events against rule patterns on their content and routes each to the appropriate targets, so publishers remain unaware of consumers. A single queue delivers each message to one consumer with no routing logic. Step Functions orchestrates a sequence the caller defines. Firehose delivers streaming data to storage destinations and performs no content-based routing.

6. An AWS Lambda function triggered by an Amazon SQS queue fails on one message in a batch, and the whole batch is retried. Which solution meets these requirements?

Answer and explanation

Answer: A. Reporting batch item failures tells the event source mapping which items failed so only those become visible again. A batch size of one removes the problem at the cost of throughput and a higher invocation count. A longer timeout does not change retry granularity. Provisioned concurrency addresses cold starts.

7. A developer must build a GraphQL API that resolves fields from Amazon DynamoDB and AWS Lambda and supports real-time subscriptions, without managing servers. Which solution meets these requirements?

Answer and explanation

Answer: C. AppSync is the managed GraphQL service with resolvers for multiple data sources and built-in subscriptions over WebSockets. Implementing GraphQL parsing behind a REST API or a function URL means building subscription handling manually. EventBridge routes events rather than serving an API.

8. A workflow runs at very high volume, completes in under a second, and does not require an exactly-once execution guarantee. Which AWS Step Functions workflow type meets these requirements at the lowest cost?

Answer and explanation

Answer: A. Express workflows are priced and designed for high-volume short-duration executions with at-least-once semantics. Standard workflows offer exactly-once execution and full history at higher cost per execution and lower throughput. Nesting a Standard workflow retains its cost characteristics. Activities are a task pattern rather than a workflow type.

9. An AWS Lambda function on a Java runtime with a large dependency set has slow cold starts. Which solution meets these requirements?

Answer and explanation

Answer: D. SnapStart takes a snapshot of the initialized execution environment and restores from it, cutting startup latency substantially for supported runtimes. A longer timeout tolerates the delay. A container image changes packaging without removing initialization work. A queue converts the call to asynchronous rather than reducing startup time.

10. A backend must push updates to connected browser clients as events occur. Which solution meets these requirements?

Answer and explanation

Answer: B. WebSocket APIs maintain a persistent bidirectional connection so the backend can push messages to clients. Polling is a client-driven workaround with latency and cost penalties. An HTTP API is request and response only. A private API restricts network reachability rather than enabling push.

11. An Amazon SQS queue must be connected to an AWS Step Functions state machine with filtering and enrichment, without writing integration code. Which solution meets these requirements?

Answer and explanation

Answer: C. EventBridge Pipes connects a source to a target with optional filtering and enrichment as a managed point-to-point integration. An EventBridge rule consumes from an event bus rather than polling a queue. A polling function is exactly the integration code being avoided. SNS subscription filters apply to topic subscriptions.

12. A client cannot determine whether an earlier request succeeded and must be able to retry safely. Which solution meets these requirements?

Answer and explanation

Answer: A. An idempotency key lets the server recognise a repeat and return the original outcome rather than performing the action twice. Networks provide no exactly-once guarantee. A longer timeout reduces retries without making them safe. Logging supports reconciliation after the fact rather than preventing duplication.

13. An application must invoke three independent AWS Lambda functions from one event and have each receive its own copy for parallel processing. Which solution meets these requirements?

Answer and explanation

Answer: A. The fan-out pattern publishes once to SNS, which delivers a copy to each subscribed queue, giving every consumer an independent buffer and retry behaviour. A single shared queue delivers each message to only one consumer. One Kinesis shard supports multiple consumers but adds ordering and throughput constraints. Sequential invocation couples the functions and loses parallelism.

14. An application must coordinate a multi-step workflow with branching, retries, and compensating actions when a later step fails. Which solution meets these requirements?

Answer and explanation

Answer: B. Step Functions expresses workflows as state machines with choice states, retry and catch behaviour, and support for compensating actions, plus a visible execution history. FIFO queues guarantee ordering but contain no orchestration logic. Recursive invocation is fragile and hard to observe. EventBridge Scheduler triggers targets on a schedule and performs no multi-step coordination.

15. An AWS Lambda function must write an item to an Amazon DynamoDB table only if no item with that partition key already exists. The function must not perform a separate read first. Which solution meets these requirements?

Answer and explanation

Answer: B. A condition expression is evaluated atomically by DynamoDB, so the write succeeds only when the key is absent and no read is required. A read followed by a write is not atomic and two concurrent invocations can both pass the check. BatchWriteItem does not support condition expressions. UpdateItem with SET creates the item when it is missing and overwrites attributes when it is not.

16. An AWS Lambda function retrieves the same configuration value from AWS Systems Manager Parameter Store on every invocation, adding latency. Which solution meets these requirements?

Answer and explanation

Answer: D. Code outside the handler runs once per execution environment, so the value is reused across every warm invocation and fetched only on a cold start. More memory raises CPU but does not remove the network round trip. Bundling the value requires a redeployment for every change. A longer timeout tolerates the latency instead of removing it.

17. An application must debit one Amazon DynamoDB item and credit another so that both writes succeed or neither takes effect. Which solution meets these requirements?

Answer and explanation

Answer: C. TransactWriteItems applies writes as a single all-or-nothing operation across items and tables. BatchWriteItem is not transactional and individual writes can fail independently. Sequential updates leave the data inconsistent if the second fails and manual rollback is itself not atomic. A stream reacts to changes after they are committed.

18. An API must return a response in under 30 milliseconds for a simple key lookup at very high request rates. Which solution meets these requirements?

Answer and explanation

Answer: A. DAX returns cached key lookups in microseconds, which comfortably meets the target at scale. Reading DynamoDB directly gives single-digit millisecond latency plus function and network overhead, which is closer to the limit under load. An RDS query involves query planning and disk access. A Scan reads the entire table and degrades as data grows.

19. An application must react whenever an item in an Amazon DynamoDB table changes, and must receive both the previous and the new state of the item. Which solution meets these requirements?

Answer and explanation

Answer: A. Streams emit an ordered change record per modification, and the new and old images view supplies both states. The keys-only view supplies neither image. TTL expires items rather than reporting changes. An index provides an alternative query path and emits no change events.

20. Items in an Amazon DynamoDB table must be removed automatically 90 days after creation without consuming write capacity. Which solution meets these requirements?

Answer and explanation

Answer: A. DynamoDB TTL deletes expired items in the background at no additional cost and without consuming write capacity. A scheduled scan and delete job consumes substantial read and write capacity. Quarterly table rotation is manual and complicates queries spanning the boundary. Reducing capacity never removes the data.

21. An Amazon API Gateway method must call another AWS service directly without an intermediate AWS Lambda function. Which integration type meets these requirements?

Answer and explanation

Answer: D. An AWS service integration maps the request directly onto another service's API, removing a function that only forwards the call. A Lambda proxy integration invokes a function. An HTTP proxy integration calls an external HTTP endpoint. A mock integration returns a canned response without calling anything.

22. An AWS Lambda function reads a secret on every invocation, and the team wants to reduce latency and API calls without writing caching code. Which solution meets these requirements?

Answer and explanation

Answer: C. The extension provides a local HTTP cache in the execution environment, cutting calls and latency with no custom code. A plaintext environment variable exposes the secret and cannot rotate. More memory does not remove the network round trip. Provisioned concurrency addresses cold starts.

23. An AWS Lambda function invoked through a function URL must return a very large response without buffering it entirely in memory. Which solution meets these requirements?

Answer and explanation

Answer: B. Response streaming sends the payload incrementally, improving time to first byte and supporting larger responses than the buffered limit. More memory does not change the buffered response limit. A presigned URL is a valid alternative pattern but does not stream the response itself. Caching stores responses rather than streaming them.

24. A developer packages an AWS Lambda function as a container image rather than a .zip archive. Which benefit does this provide?

Answer and explanation

Answer: A. Container images support far larger artifacts and let teams use familiar build and registry tooling. Cold start behaviour depends on image size and is not universally better. An execution role is required regardless of packaging. Scaling behaviour is identical for both packaging formats.

25. An application must publish a high-cardinality custom metric from many AWS Lambda invocations without a synchronous API call in each invocation. Which solution meets these requirements?

Answer and explanation

Answer: C. Embedded metric format writes structured log entries that CloudWatch parses into metrics asynchronously, avoiding a synchronous call and its latency and throttling. PutMetricData per invocation adds latency and cost. An alarm on invocation count measures something different. X-Ray annotations are for trace filtering rather than metrics.

26. An AWS Lambda function processes Amazon S3 upload events, and events are lost when the function errors after all retries. Which solution meets these requirements?

Answer and explanation

Answer: A. S3 invokes Lambda asynchronously, and the event is discarded after built-in retries unless an on-failure destination captures it. A longer timeout helps only when failures are caused by duration. More memory addresses resource exhaustion. Reserved concurrency limits scaling and does not preserve a failed event.

27. An application reads items from an Amazon DynamoDB table where most queries need only three of the twenty attributes. Which solution most reduces consumed read capacity?

Answer and explanation

Answer: A. A projection expression limits which attributes are returned, and DynamoDB charges read capacity on the size of the item returned. Raising capacity increases cost rather than reducing consumption. Eventually consistent reads halve the cost per read but still return the full item. An index projecting all attributes duplicates storage and saves nothing.

28. A client must retrieve a large Amazon DynamoDB Query result set across several requests. Which solution meets these requirements?

Answer and explanation

Answer: D. DynamoDB paginates results and returns LastEvaluatedKey when more data remains, and supplying it as ExclusiveStartKey retrieves the following page. The Limit parameter caps items per page and cannot exceed the one-megabyte response ceiling. A Scan reads the whole table. Streams deliver a change log rather than query results.

29. An application caches data in Amazon ElastiCache and loads an item into the cache only when a read misses. Which caching strategy does this describe?

Answer and explanation

Answer: C. Lazy loading populates the cache on a miss, so only requested data is cached and the first request pays the penalty. Write-through populates on every write and caches data that may never be read. Write-behind defers the write to the backing store. Pre-warming loads data before requests arrive.

30. An application must write 30 items to Amazon DynamoDB in one logical operation. Partial success is acceptable and throughput matters more than atomicity. Which solution meets these requirements?

Answer and explanation

Answer: B. BatchWriteItem sends up to 25 items per request with independent success or failure, giving higher throughput than individual calls when atomicity is not required. TransactWriteItems is atomic but more expensive and unnecessary here. A loop of PutItem calls incurs a round trip per item. UpdateItem addresses a single item at a time.

31. A DynamoDB table uses customerId as the partition key and orderDate as the sort key. The application must also query all orders by status across every customer. Which solution meets these requirements?

Answer and explanation

Answer: C. A global secondary index supports a partition key different from the base table's, which is what querying by status across all customers requires. A local secondary index must share the base partition key and cannot span customers. A Scan reads every item and degrades as data grows. Appending status to the sort key still confines queries to a single customerId.

32. A Lambda function must process records from an Amazon SQS queue and return only the failed records for retry. Which solution meets these requirements?

Answer and explanation

Answer: C. Partial batch failure reporting returns only the failed identifiers while successful messages are acknowledged. Throwing an exception retries the whole batch. Manual deletion is possible but partial batch response is the supported mechanism. A visibility timeout shorter than the function timeout causes duplicate processing.

33. A Lambda function's initialization code opens a database connection that should be reused across invocations. Where should the connection be created?

Answer and explanation

Answer: D. Code outside the handler runs once per execution environment and its objects persist across warm invocations. Creating the connection inside the handler opens one per invocation. A separate function does not share the environment. Environment variables hold values rather than connections.

34. A developer must invoke a Lambda function and receive the response in the same call. Which invocation type is appropriate?

Answer and explanation

Answer: C. RequestResponse invokes synchronously and returns the result. Event queues the invocation and returns immediately. DryRun validates without running. An event source mapping polls rather than being invoked directly.

35. An application must retry a failed AWS API call without overwhelming the service. Which approach is appropriate?

Answer and explanation

Answer: D. Exponential backoff with jitter spreads retries so clients do not converge on the same instant. A tight loop amplifies the problem. A single retry gives up on transient conditions. A longer timeout waits without retrying.

36. An application must be designed so that processing the same message twice produces the same result. Which property does this describe?

Answer and explanation

Answer: A. Idempotency means repeated application produces the same result. Statelessness concerns holding no session state. Loose coupling concerns component independence. Eventual consistency concerns replica convergence.

37. A Lambda function must access a resource in a VPC and also reach a public AWS service endpoint. Which configuration is required?

Answer and explanation

Answer: B. A VPC-attached function loses default internet access, so a NAT gateway or interface endpoints are required. VPC attachment does not grant internet access. Leaving the function outside the VPC prevents reaching private resources. Functions do not take Elastic IP addresses.

38. A Lambda function must share common libraries with several other functions without bundling them in each package. Which solution meets these requirements?

Answer and explanation

Answer: D. A layer packages shared libraries once and attaches to many functions. Bundling duplicates them. Downloading at invocation adds latency to every call. Environment variables hold values rather than libraries.

39. A Lambda function's cold start latency must be reduced for a latency-sensitive endpoint. Which solution meets these requirements?

Answer and explanation

Answer: B. Provisioned concurrency keeps environments initialized, removing the cold start. Reserved concurrency caps scale without pre-initializing. A longer timeout does not affect startup. Less memory generally slows initialization.

40. A Lambda function must be prevented from consuming all of an account's concurrency during a traffic spike. Which solution meets these requirements?

Answer and explanation

Answer: A. Reserved concurrency both guarantees and caps a function's concurrency. Provisioned concurrency pre-initializes without capping. Memory and timeout affect execution characteristics rather than concurrency.

41. A Lambda function's environment variables contain a value that must be encrypted with a key the team controls. Which solution meets these requirements?

Answer and explanation

Answer: C. Encryption helpers with a customer managed key encrypt the variable at rest with a key the team controls. Plaintext with access restriction still exposes the value to anyone who can describe the function. Code storage places it in source control. Base64 is encoding rather than encryption.

42. An application must write an item to DynamoDB only if an item with that key does not already exist. Which approach is appropriate?

Answer and explanation

Answer: C. A condition expression makes the write conditional atomically. A read followed by a write has a race between them. UpdateItem writes regardless. BatchWriteItem does not support condition expressions.

43. A DynamoDB query returns a LastEvaluatedKey in its response. What does this indicate?

Answer and explanation

Answer: D. LastEvaluatedKey signals pagination and is passed as ExclusiveStartKey for the next page. Failures, throttling, and size limits produce errors rather than this field.

44. An application must read an item from DynamoDB and be certain it reflects all writes that completed before the read. Which read type is required?

Answer and explanation

Answer: D. A strongly consistent read returns the most recent completed write. Eventually consistent reads may return stale data. Global secondary indexes support eventually consistent reads only.

45. A DynamoDB table's items must be cached to reduce read latency to microseconds without changing application code significantly. Which solution meets these requirements?

Answer and explanation

Answer: A. DAX is API-compatible so the application changes minimally. ElastiCache requires the application to manage the cache explicitly. More capacity serves reads at millisecond latency. An index supports different query patterns.

46. An application must upload a 500 MB file to Amazon S3 reliably over an unstable connection. Which approach is appropriate?

Answer and explanation

Answer: C. Multipart upload retries individual parts rather than the whole transfer. A single call restarts from the beginning on failure. Separate objects push reassembly onto every reader. Compression reduces size without improving resilience.

47. An application must grant a user temporary permission to download a specific S3 object without making the bucket public. Which solution meets these requirements?

Answer and explanation

Answer: A. A presigned URL grants time-limited access to one object. Public access exposes it to everyone. A permanent policy entry is not temporary. An IAM user per download does not scale.

48. A DynamoDB transaction must write to two tables so either both succeed or neither does. Which operation is appropriate?

Answer and explanation

Answer: D. TransactWriteItems applies writes atomically across tables. BatchWriteItem groups for efficiency without atomicity. Separate calls and conditional updates can leave one side applied.

49. An application must generate a unique identifier for each request that is safe to use across distributed components. Which approach is appropriate?

Answer and explanation

Answer: D. A universally unique identifier needs no coordination and is safe across components. An in-memory counter is per instance, timestamps collide under concurrency, and an instance identifier is not per request.