Challenge - 5 Problems
Redis TYPE Command Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:00remaining
Check the type of a string key
Given a Redis database where the key
user:1000 holds the value "Alice" as a string, what will be the output of the command TYPE user:1000?Redis
TYPE user:1000Attempts:
2 left
💡 Hint
Remember that Redis stores simple text values as strings.
✗ Incorrect
The TYPE command returns the data type of the key. Since
user:1000 holds a string value, the output is "string".❓ query_result
intermediate1:00remaining
Check type of a non-existing key
What will the command
TYPE session:9999 return if the key session:9999 does not exist in the Redis database?Redis
TYPE session:9999Attempts:
2 left
💡 Hint
Think about what Redis returns when a key is missing.
✗ Incorrect
Redis returns "none" when the key does not exist.
❓ query_result
advanced1:30remaining
Identify the type of a sorted set key
If the key
leaderboard contains a sorted set of player scores, what will TYPE leaderboard return?Redis
TYPE leaderboard
Attempts:
2 left
💡 Hint
Sorted sets have a special type name in Redis.
✗ Incorrect
Redis uses "zset" to represent sorted sets.
❓ query_result
advanced1:30remaining
Detect type of a hash key
What is the output of
TYPE user:profile if user:profile is a hash storing user attributes?Redis
TYPE user:profile
Attempts:
2 left
💡 Hint
Hashes store field-value pairs in Redis.
✗ Incorrect
The TYPE command returns "hash" for keys storing hashes.
🧠 Conceptual
expert2:00remaining
Understanding TYPE command behavior with expired keys
If a key
temp:data is set with an expiration and expires before the TYPE temp:data command is run, what will the TYPE command return?Attempts:
2 left
💡 Hint
Expired keys are automatically removed from Redis.
✗ Incorrect
Once a key expires, it is deleted and no longer exists, so TYPE returns "none".