0
0
DynamoDBquery~20 mins

Limit and pagination in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Pagination Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
1:30remaining
What is the output of this DynamoDB scan with Limit?

Consider a DynamoDB table named Books with 10 items. You run this scan command with Limit=3:

aws dynamodb scan --table-name Books --limit 3

What will be the number of items returned in Items?

A10 items
B3 items
C0 items
DAll items except 3
Attempts:
2 left
💡 Hint

The Limit parameter controls how many items are returned in one response.

query_result
intermediate
1:30remaining
What happens when you use LastEvaluatedKey in DynamoDB pagination?

You perform a scan on a DynamoDB table with Limit=2. The response includes LastEvaluatedKey. What does this key represent?

AThe key to start the next scan to get more items
BThe last item returned in the current scan
CThe primary key of the first item in the table
DAn error indicator for the scan
Attempts:
2 left
💡 Hint

Think about how you get the next page of results in DynamoDB.

📝 Syntax
advanced
2:00remaining
Which DynamoDB scan command correctly paginates to get the next 5 items?

You have the LastEvaluatedKey from a previous scan stored in a JSON file lastkey.json. Which command correctly uses it to get the next 5 items?

Aaws dynamodb scan --table-name Books --limit 5 --last-evaluated-key file://lastkey.json
Baws dynamodb scan --table-name Books --limit 5 --start-key file://lastkey.json
Caws dynamodb scan --table-name Books --limit 5 --exclusive-start-key file://lastkey.json
Daws dynamodb scan --table-name Books --limit 5 --startExclusiveKey file://lastkey.json
Attempts:
2 left
💡 Hint

Check the exact parameter name for starting a scan from a key.

🧠 Conceptual
advanced
1:30remaining
Why might a DynamoDB scan with Limit not return the exact number of items requested?

You set Limit=5 in a scan, but the response returns fewer than 5 items without LastEvaluatedKey. Why?

ABecause Limit only applies to the number of attributes, not items
BBecause Limit is ignored if the table has more items
CBecause the scan failed and returned partial data
DBecause the scan reached the end of the table and fewer items remain
Attempts:
2 left
💡 Hint

Think about what happens when you reach the last items in the table.

optimization
expert
2:30remaining
How to efficiently paginate large DynamoDB tables without scanning all items?

You want to paginate through a large DynamoDB table efficiently. Which approach is best?

AUse Query with a partition key and ExclusiveStartKey for pagination
BUse Scan with Limit and LastEvaluatedKey repeatedly
CUse Scan without Limit to get all items at once
DUse Query without specifying a key to get all items
Attempts:
2 left
💡 Hint

Consider how DynamoDB is optimized for queries on keys.