Challenge - 5 Problems
DynamoDB Attribute Types Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:30remaining
What is the output of this DynamoDB item retrieval?
Given a DynamoDB item with attribute types:
{"Name": {"S": "Alice"}, "Age": {"N": "30"}, "Active": {"BOOL": true}}
What will be the value of the "Age" attribute when retrieved?
{"Name": {"S": "Alice"}, "Age": {"N": "30"}, "Active": {"BOOL": true}}
What will be the value of the "Age" attribute when retrieved?
Attempts:
2 left
💡 Hint
Remember that DynamoDB stores numbers as strings in the N type.
✗ Incorrect
DynamoDB stores numbers as strings under the N attribute type internally, but when retrieved via the AWS SDK, the value is returned as a numeric type. So when you retrieve the Age attribute, its value is the number 30, not a string.
❓ query_result
intermediate1:30remaining
What is the output of this DynamoDB item with nested map and list?
Consider this DynamoDB item:
{"User": {"M": {"Name": {"S": "Bob"}, "Scores": {"L": [{"N": "10"}, {"N": "20"}]}}}}
What is the value type of "Scores" inside "User"?
{"User": {"M": {"Name": {"S": "Bob"}, "Scores": {"L": [{"N": "10"}, {"N": "20"}]}}}}
What is the value type of "Scores" inside "User"?
Attempts:
2 left
💡 Hint
Look at the L and N attribute types inside the Scores attribute.
✗ Incorrect
The Scores attribute is a list (L) containing two numbers (N). So it is a list of numbers.
📝 Syntax
advanced2:00remaining
Which option correctly defines a DynamoDB item with a binary attribute?
You want to store a binary attribute named "ImageData" in DynamoDB. Which of the following JSON representations is syntactically correct?
Attempts:
2 left
💡 Hint
Binary data uses the B attribute type and is base64 encoded.
✗ Incorrect
The B attribute type is used for binary data and expects a base64 encoded string. Option A correctly uses B with a base64 string.
🧠 Conceptual
advanced1:00remaining
Which attribute type is best to store a true/false value in DynamoDB?
You want to store a flag indicating if a user is active or not. Which DynamoDB attribute type should you use?
Attempts:
2 left
💡 Hint
DynamoDB has a dedicated type for true/false values.
✗ Incorrect
The BOOL attribute type is designed to store boolean true or false values directly.
🔧 Debug
expert2:30remaining
Why does this DynamoDB query fail to retrieve the nested map attribute?
You have this item:
{"Profile": {"M": {"Name": {"S": "Eve"}, "Count": {"M": {"Age": {"N": "25"}}}}}}
You try to get the Age value with this expression:
ProjectionExpression: "Profile.Count.Age"
But the query returns no value for Age. What is the likely cause?
{"Profile": {"M": {"Name": {"S": "Eve"}, "Count": {"M": {"Age": {"N": "25"}}}}}}
You try to get the Age value with this expression:
ProjectionExpression: "Profile.Count.Age"
But the query returns no value for Age. What is the likely cause?
Attempts:
2 left
💡 Hint
Check how DynamoDB handles nested attribute names in ProjectionExpression.
✗ Incorrect
DynamoDB requires using expression attribute names (like #P, #C, #A) to access nested map keys in ProjectionExpression to avoid reserved word conflicts.