0
0
DynamoDBquery~20 mins

TransactGetItems in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
TransactGetItems Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Output of a TransactGetItems with two valid keys
Given a DynamoDB table named Users with primary key UserId, what is the output of the following TransactGetItems request?
DynamoDB
TransactGetItems({
  TransactItems: [
    { Get: { TableName: "Users", Key: { UserId: { S: "user1" } } } },
    { Get: { TableName: "Users", Key: { UserId: { S: "user2" } } } }
  ]
})
AReturns only the first item found and ignores the second key.
BReturns an array with two items, each containing the full item data for user1 and user2 respectively.
CThrows a syntax error because TransactGetItems cannot have multiple items.
DReturns an empty array because TransactGetItems does not support Get operations.
Attempts:
2 left
💡 Hint
TransactGetItems allows multiple Get operations in one atomic request.
🧠 Conceptual
intermediate
1:30remaining
Understanding atomicity in TransactGetItems
Which statement best describes the atomicity behavior of TransactGetItems in DynamoDB?
AAll requested items are retrieved atomically; either all succeed or none are returned.
BEach item is retrieved independently; some items may succeed while others fail.
CTransactGetItems only guarantees atomicity for write operations, not reads.
DAtomicity is not supported; results are returned as they are found.
Attempts:
2 left
💡 Hint
Think about what atomic means in database transactions.
📝 Syntax
advanced
2:00remaining
Identify the syntax error in this TransactGetItems request
Which option contains a syntax error that will cause the TransactGetItems request to fail?
DynamoDB
TransactGetItems({
  TransactItems: [
    { Get: { TableName: "Products", Key: { ProductId: { N: "101" } } } },
    { Get: { TableName: "Products", Key: { ProductId: 102 } } }
  ]
})
ATransactItems array must contain only one Get operation.
BThe first Get operation uses a string for ProductId instead of a number.
CTableName must be lowercase.
DThe second Get operation's Key value for ProductId is missing the data type wrapper (N).
Attempts:
2 left
💡 Hint
DynamoDB requires attribute values to specify their data types explicitly.
optimization
advanced
2:00remaining
Optimizing multiple item retrieval with TransactGetItems
You need to retrieve 10 items from the same DynamoDB table by their keys. Which approach is the most efficient and atomic?
AUse a single TransactGetItems request with 10 Get operations inside TransactItems.
BSend 10 separate GetItem requests, one for each key.
CUse BatchGetItem with 10 keys in one request.
DUse Scan operation with a filter for the 10 keys.
Attempts:
2 left
💡 Hint
Consider atomicity and number of network calls.
🔧 Debug
expert
2:30remaining
Diagnose the error from a TransactGetItems request with a missing key attribute
A TransactGetItems request fails with a ValidationException. The request is:
DynamoDB
TransactGetItems({
  TransactItems: [
    { Get: { TableName: "Orders", Key: { OrderId: { S: "123" } } } },
    { Get: { TableName: "Orders", Key: { } } }
  ]
})
ATransactGetItems cannot have more than one Get operation.
BTableName "Orders" is invalid because it contains uppercase letters.
CThe second Get operation has an empty Key object, causing a ValidationException.
DThe first Get operation's Key attribute type is incorrect; it should be a number.
Attempts:
2 left
💡 Hint
Check if all Get operations specify a valid key.