0
0
DynamoDBquery~20 mins

Basic scan operation in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Scan Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2: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;
AOnly the first 10 items are returned by default.
BOnly items with attribute Author = 'Unknown' are returned.
CNo items are returned because no filter is specified.
DAll items in the Books table are returned.
Attempts:
2 left
💡 Hint
A scan without filters returns all items in the table.
query_result
intermediate
2: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;
AAll users with Age greater than 30 are returned.
BAll users are returned because FilterExpression is ignored in scan.
COnly users with Age exactly 30 are returned.
DScan returns an error due to invalid FilterExpression syntax.
Attempts:
2 left
💡 Hint
FilterExpression filters items after scanning all.
📝 Syntax
advanced
2: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.
A{ TableName: "Orders", FilterExpression: "Price > :p", ExpressionAttributeValues: { ":p": 100 } }
B{ TableName: "Orders", FilterExpression: "Price > :p", ExpressionAttributeValues: { ":p" 100 } }
C{ TableName: "Orders", Limit: 5 }
D{ TableName: "Orders" }
Attempts:
2 left
💡 Hint
Check for missing colon or comma in object literals.
optimization
advanced
2: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?
AUse FilterExpression to reduce items scanned.
BUse ScanIndexForward to scan in ascending order.
CUse ProjectionExpression to return only needed attributes.
DUse ConsistentRead set to true.
Attempts:
2 left
💡 Hint
Returning fewer attributes reduces data read.
🔧 Debug
expert
2: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?
AScan Limit limits the number of items returned, but if FilterExpression excludes some items, fewer are returned.
BScan Limit limits the number of items returned, but scan may return fewer if fewer items are available in the segment.
CScan Limit limits the number of items returned, but scan may return fewer if the response is paginated and only first page is fetched.
DScan Limit limits the number of items evaluated, not the number returned after filtering.
Attempts:
2 left
💡 Hint
Consider if any filtering is applied after scan.