Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to perform a strongly consistent read in DynamoDB.
DynamoDB
response = table.get_item(Key={'id': '123'}, ConsistentRead=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string 'True' instead of boolean True
Setting ConsistentRead to False expecting strong consistency
✗ Incorrect
Setting ConsistentRead=True ensures a strongly consistent read in DynamoDB.
2fill in blank
mediumComplete the code to perform an eventually consistent read in DynamoDB.
DynamoDB
response = table.get_item(Key={'id': '456'}, ConsistentRead=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string 'False' instead of boolean False
Setting ConsistentRead to True expecting eventual consistency
✗ Incorrect
Setting ConsistentRead=False or omitting it performs an eventually consistent read.
3fill in blank
hardFix the error in the code to correctly request a consistent read.
DynamoDB
response = table.get_item(Key={'id': '789'}, ConsistentRead=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or string values for ConsistentRead
Confusing string and boolean types
✗ Incorrect
The ConsistentRead parameter must be a boolean True, not a string or lowercase.
4fill in blank
hardFill both blanks to perform a query with a consistent read.
DynamoDB
response = table.query(KeyConditionExpression=Key('userId').eq('user123'), [1]=[2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using FilterExpression instead of ConsistentRead for consistency
Setting ConsistentRead to False expecting strong consistency
✗ Incorrect
Use ConsistentRead=True to get a strongly consistent query result.
5fill in blank
hardFill all three blanks to create a strongly consistent scan with a filter expression.
DynamoDB
response = table.scan([1]=[2], [3]=Attr('status').eq('active'))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up FilterExpression and ConsistentRead parameters
Using False instead of True for ConsistentRead
✗ Incorrect
Use ConsistentRead=True and FilterExpression to scan with strong consistency and filter results.