0
0
DynamoDBquery~20 mins

Scan with filter expressions in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Scan Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Scan with a simple filter expression
Given a DynamoDB table named Products with items having attributes Category and Price, what will be the output of this scan operation?

Scan with FilterExpression: Category = :cat
ExpressionAttributeValues: { ':cat': { S: 'Books' } }
DynamoDB
aws dynamodb scan --table-name Products --filter-expression "Category = :cat" --expression-attribute-values '{":cat":{"S":"Books"}}'
AReturns items where Category contains the substring 'Books'
BReturns all items regardless of Category
CReturns no items because filter expression is invalid
DReturns all items where Category is exactly 'Books'
Attempts:
2 left
💡 Hint
FilterExpression filters items after scanning all; it matches exact values unless using functions.
query_result
intermediate
2:00remaining
Scan with numeric filter expression
Consider a DynamoDB table Orders with attribute Amount (number). What will this scan return?

FilterExpression: Amount > :minAmount
ExpressionAttributeValues: { ':minAmount': { N: '100' } }
DynamoDB
aws dynamodb scan --table-name Orders --filter-expression "Amount > :minAmount" --expression-attribute-values '{":minAmount":{"N":"100"}}'
AAll items with Amount greater than or equal to 100
BAll items with Amount greater than 100
CAll items with Amount less than 100
DNo items because numeric comparison is not supported in filter expressions
Attempts:
2 left
💡 Hint
Filter expressions support numeric comparisons like >, <, =.
📝 Syntax
advanced
2:00remaining
Identify the syntax error in filter expression
Which option contains a syntax error in the DynamoDB scan filter expression?
DynamoDB
Scan command with filter expressions
AFilterExpression: "Price => :minPrice" with ExpressionAttributeValues { ':minPrice': {N: '15'} }
BFilterExpression: "contains(ProductName, :name)" with ExpressionAttributeValues { ':name': {S: 'Book'} }
CFilterExpression: "Category = :cat OR Price > :price" with ExpressionAttributeValues { ':cat': {S: 'Books'}, ':price': {N: '20'} }
DFilterExpression: "Price BETWEEN :low AND :high" with ExpressionAttributeValues { ':low': {N: '10'}, ':high': {N: '50'} }
Attempts:
2 left
💡 Hint
Check the comparison operator syntax carefully.
query_result
advanced
2:00remaining
Scan with multiple filter conditions
What items will be returned by this scan?

FilterExpression: "Category = :cat AND Price BETWEEN :low AND :high"
ExpressionAttributeValues: { ':cat': { S: 'Electronics' }, ':low': { N: '100' }, ':high': { N: '500' } }
DynamoDB
aws dynamodb scan --table-name Products --filter-expression "Category = :cat AND Price BETWEEN :low AND :high" --expression-attribute-values '{":cat":{"S":"Electronics"},":low":{"N":"100"},":high":{"N":"500"}}'
AItems with Price between 100 and 500 only
BItems with Category 'Electronics' or Price between 100 and 500
CItems with Category 'Electronics' and Price between 100 and 500 inclusive
DNo items because AND operator is not supported in filter expressions
Attempts:
2 left
💡 Hint
AND operator combines conditions that must all be true.
🧠 Conceptual
expert
2:00remaining
Understanding scan with filter expressions and performance
Which statement best describes the behavior and performance impact of using filter expressions in DynamoDB scans?
AFilter expressions are applied after scanning all items, so they do not reduce read capacity units consumed.
BFilter expressions reduce the number of items read from the table, improving scan performance.
CFilter expressions prevent DynamoDB from scanning items that do not match the filter, saving costs.
DFilter expressions automatically create indexes to speed up scans.
Attempts:
2 left
💡 Hint
Think about when filtering happens during a scan operation.