0
0
DynamoDBquery~20 mins

Unprocessed items handling in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Unprocessed Items Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output when BatchWriteItem returns unprocessed items?

You send a BatchWriteItem request to DynamoDB with 5 items. The response contains 2 unprocessed items. What does this mean?

AAll 5 items were written successfully.
B2 items were not written and need to be retried.
CThe request failed and no items were written.
DOnly 3 items were sent to DynamoDB.
Attempts:
2 left
💡 Hint

Unprocessed items are those DynamoDB could not write due to capacity limits.

🧠 Conceptual
intermediate
2:00remaining
Why does DynamoDB return unprocessed items in BatchWriteItem?

Which of the following is the main reason DynamoDB returns unprocessed items in a BatchWriteItem response?

ABecause DynamoDB exceeded provisioned throughput limits.
BBecause the request syntax was invalid.
CBecause the items were duplicates.
DBecause the table does not exist.
Attempts:
2 left
💡 Hint

Think about capacity and limits on writes per second.

📝 Syntax
advanced
3:00remaining
Which code snippet correctly retries unprocessed items in BatchWriteItem?

Given a BatchWriteItem response with unprocessed items, which code snippet correctly retries them until all are processed?

A
while response['UnprocessedItems'] is None:
    response = client.batch_write_item(RequestItems=response['UnprocessedItems'])
B
if response['UnprocessedItems']:
    client.batch_write_item(RequestItems=response['UnprocessedItems'])
C
for item in response['UnprocessedItems']:
    client.batch_write_item(RequestItems=item)
D
while 'UnprocessedItems' in response and response['UnprocessedItems']:
    response = client.batch_write_item(RequestItems=response['UnprocessedItems'])
Attempts:
2 left
💡 Hint

Retry while unprocessed items exist.

optimization
advanced
3:00remaining
How to optimize handling of unprocessed items in BatchWriteItem?

Which approach best optimizes handling unprocessed items returned by BatchWriteItem to avoid throttling?

AUse exponential backoff with jitter when retrying unprocessed items.
BImmediately retry all unprocessed items in a tight loop without delay.
CIgnore unprocessed items and proceed without retrying.
DSplit unprocessed items into single-item requests and retry sequentially.
Attempts:
2 left
💡 Hint

Think about how to reduce load and avoid repeated throttling.

🔧 Debug
expert
3:00remaining
Why does this retry code cause infinite loop on unprocessed items?

Consider this Python code snippet retrying unprocessed items from BatchWriteItem:

while response['UnprocessedItems']:
    response = client.batch_write_item(RequestItems=response['UnprocessedItems'])

Why might this cause an infinite loop?

DynamoDB
while response['UnprocessedItems']:
    response = client.batch_write_item(RequestItems=response['UnprocessedItems'])
ABecause the loop condition should check for None, not empty dict.
BBecause 'UnprocessedItems' key is missing from response, causing KeyError.
CBecause it retries immediately without delay, causing repeated throttling and unprocessed items never clear.
DBecause batch_write_item does not accept 'RequestItems' parameter.
Attempts:
2 left
💡 Hint

Think about what happens if you retry too fast.