0
0
DynamoDBquery~10 mins

Scan vs Query performance comparison in DynamoDB - Interactive Practice

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

Complete the code to perform a Query operation on a DynamoDB table.

DynamoDB
response = table.[1](KeyConditionExpression=Key('UserId').eq('123'))
Drag options to blanks, or click blank then click option'
Aget_item
Bscan
Cquery
Dput_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using scan instead of query for key-based retrieval.
2fill in blank
medium

Complete the code to perform a Scan operation on a DynamoDB table.

DynamoDB
response = table.[1]()
Drag options to blanks, or click blank then click option'
Aquery
Bscan
Cget_item
Ddelete_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using query when wanting to read all items.
3fill in blank
hard

Fix the error in the code to improve performance by using the correct method.

DynamoDB
response = table.[1](KeyConditionExpression=Key('Status').eq('Active'))
Drag options to blanks, or click blank then click option'
Aquery
Bput_item
Cget_item
Dscan
Attempts:
3 left
💡 Hint
Common Mistakes
Using scan with filter instead of query with key condition.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that shows item counts for active users using Query.

DynamoDB
active_users = {item['UserId']: item['Count'] for item in table.[1](KeyConditionExpression=Key('Status').eq('Active')).[2]
Drag options to blanks, or click blank then click option'
Aquery
Bscan
CItems
Dresponse
Attempts:
3 left
💡 Hint
Common Mistakes
Using scan instead of query, or accessing wrong attribute for items.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters items with Query and a condition.

DynamoDB
filtered = {item['Id']: item['Value'] for item in table.[1](KeyConditionExpression=Key('Category').eq('Books')).[2] if item['Value'] [3] 100}
Drag options to blanks, or click blank then click option'
Aquery
BItems
C>
Dscan
Attempts:
3 left
💡 Hint
Common Mistakes
Using scan instead of query, or wrong comparison operator.