0
0
DynamoDBquery~10 mins

Scan pagination in DynamoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a scan operation on the DynamoDB table.

DynamoDB
response = table.[1]()
Drag options to blanks, or click blank then click option'
Ascan
Bquery
Cget_item
Dput_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using query instead of scan for reading all items.
Trying to use get_item which requires a key.
2fill in blank
medium

Complete the code to get the next page of results using the LastEvaluatedKey.

DynamoDB
response = table.scan(ExclusiveStartKey=[1])
Drag options to blanks, or click blank then click option'
Aresponse['NextKey']
Bresponse['StartKey']
Cresponse['LastEvaluatedKey']
Dresponse['NextEvaluatedKey']
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong key name like NextKey or StartKey.
Not using ExclusiveStartKey to continue scanning.
3fill in blank
hard

Fix the error in the code to correctly check if there are more pages to scan.

DynamoDB
if 'LastEvaluatedKey' [1] response:
Drag options to blanks, or click blank then click option'
Anot in
Bin
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using == or != to check for key presence.
Using not in which checks for absence.
4fill in blank
hard

Fill both blanks to correctly paginate through all items in the table.

DynamoDB
while [1]:
    response = table.scan(ExclusiveStartKey=[2])
    items.extend(response['Items'])
Drag options to blanks, or click blank then click option'
ALastEvaluatedKey
Bresponse.get('LastEvaluatedKey')
Cresponse['LastEvaluatedKey']
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using direct dictionary access which can cause KeyError.
Using a variable that is not updated inside the loop.
5fill in blank
hard

Fill all three blanks to implement a full scan with pagination collecting all items.

DynamoDB
items = []
start_key = [1]
while start_key [2] None:
    response = table.scan(ExclusiveStartKey=start_key)
    items.extend(response['Items'])
    start_key = response.[3]('LastEvaluatedKey')
Drag options to blanks, or click blank then click option'
ANone
B!=
Cget
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Starting with an undefined start_key.
Using == instead of != in the loop condition.
Accessing LastEvaluatedKey directly causing errors.