0
0
AWScloud~10 mins

Put, get, and query operations in AWS - Interactive Code Practice

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

Complete the code to put an item into a DynamoDB table.

AWS
response = table.[1](Item={'UserId': '123', 'Name': 'Alice'})
Drag options to blanks, or click blank then click option'
Aquery
Bput_item
Cget_item
Dscan
Attempts:
3 left
💡 Hint
Common Mistakes
Using get_item instead of put_item will try to retrieve data, not add it.
Using query or scan are for reading data, not writing.
2fill in blank
medium

Complete the code to get an item from a DynamoDB table by its key.

AWS
response = table.[1](Key={'UserId': '123'})
Drag options to blanks, or click blank then click option'
Aquery
Bput_item
Cget_item
Ddelete_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using put_item will add data instead of retrieving it.
Using query is for searching with conditions, not direct key retrieval.
3fill in blank
hard

Fix the error in the query operation to find items with UserId '123'.

AWS
response = table.query(
    KeyConditionExpression=Key('UserId').[1]('123')
)
Drag options to blanks, or click blank then click option'
Aeq
Bequals
Cequal
Dmatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'equals' or 'equal' causes errors because they are not valid methods.
Using 'match' is not a DynamoDB Key method.
4fill in blank
hard

Fill both blanks to query items where UserId equals '123' and Status equals 'active'.

AWS
response = table.query(
    KeyConditionExpression=Key('UserId').[1]('123') & Key('Status').[2]('active')
)
Drag options to blanks, or click blank then click option'
Aeq
Bgt
Dlt
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gt' or 'lt' will filter for greater or less than, not equality.
Mixing different methods causes query errors.
5fill in blank
hard

Fill all three blanks to get items with UserId '123', Status 'active', and sort by Timestamp descending.

AWS
response = table.query(
    KeyConditionExpression=Key('UserId').[1]('123') & Key('Status').[2]('active'),
    ScanIndexForward=[3]
)
Drag options to blanks, or click blank then click option'
Aeq
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using True for ScanIndexForward sorts ascending, not descending.
Using other methods than 'eq' for conditions causes errors.