Challenge - 5 Problems
DynamoDB Scan Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What does this DynamoDB scan return?
Consider a DynamoDB table named Books with items having attributes
Title and Author. The following scan operation is executed:ScanInput = { TableName: "Books" }What will be the output of this scan?DynamoDB
const params = { TableName: "Books" };
const result = await dynamodb.scan(params).promise();
return result.Items;Attempts:
2 left
💡 Hint
A scan without filters returns all items in the table.
✗ Incorrect
A scan operation without any filter or limit returns all items in the table. It reads every item and returns them.
❓ query_result
intermediate2:00remaining
What is the output of this filtered scan?
Given a DynamoDB table Users with attribute
Age, the following scan is run:ScanInput = {
TableName: "Users",
FilterExpression: "Age > :minAge",
ExpressionAttributeValues: { ":minAge": 30 }
}What does this scan return?DynamoDB
const params = {
TableName: "Users",
FilterExpression: "Age > :minAge",
ExpressionAttributeValues: { ":minAge": 30 }
};
const result = await dynamodb.scan(params).promise();
return result.Items;Attempts:
2 left
💡 Hint
FilterExpression filters items after scanning all.
✗ Incorrect
FilterExpression filters the scanned items to only those matching the condition. Here, only users with Age > 30 are returned.
📝 Syntax
advanced2:00remaining
Which scan parameter causes a syntax error?
Identify which of the following scan parameter objects will cause a syntax error when used in DynamoDB scan operation.
Attempts:
2 left
💡 Hint
Check for missing colon or comma in object literals.
✗ Incorrect
Option B is missing a colon between ":p" and 100 in ExpressionAttributeValues, causing a syntax error.
❓ optimization
advanced2:00remaining
How to optimize a scan to reduce read capacity usage?
You want to scan a large DynamoDB table but reduce the read capacity units consumed. Which option below helps achieve this?
Attempts:
2 left
💡 Hint
Returning fewer attributes reduces data read.
✗ Incorrect
ProjectionExpression limits attributes returned, reducing data size and read capacity used. FilterExpression filters after reading all items, so it doesn't reduce read capacity.
🔧 Debug
expert2:00remaining
Why does this scan return fewer items than expected?
A DynamoDB scan on table Products uses the following parameters:
{ TableName: "Products", Limit: 5 }After running the scan, only 3 items are returned, but the table has 10 items. Why?Attempts:
2 left
💡 Hint
Consider if any filtering is applied after scan.
✗ Incorrect
If a FilterExpression is used, the Limit applies before filtering, so fewer items may be returned after filtering excludes some items.