0
0
Redisquery~20 mins

ZSCORE for member score in Redis - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Redis ZSCORE Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of ZSCORE for an existing member?
Given a sorted set named players with members and their scores, what will be the output of ZSCORE players "Alice" if Alice's score is 1500?
Redis
ZADD players 1500 Alice
ZSCORE players "Alice"
A"1500"
BError: member not found
Cnil
D1500
Attempts:
2 left
💡 Hint
Remember that ZSCORE returns the score as a string if the member exists.
query_result
intermediate
2:00remaining
What does ZSCORE return for a non-existing member?
If you run ZSCORE players "Bob" but Bob is not in the sorted set, what will Redis return?
Redis
ZADD players 1500 Alice
ZSCORE players "Bob"
Anil
B""
CError: member not found
D"0"
Attempts:
2 left
💡 Hint
Think about what Redis returns when a member is missing in a sorted set.
🧠 Conceptual
advanced
2:00remaining
Why does ZSCORE return scores as strings?
Which reason best explains why Redis returns the score as a string when using ZSCORE?
ABecause Redis converts scores to integers before returning them.
BBecause Redis stores all data internally as strings for consistency and network transmission.
CBecause Redis uses JSON format for all responses.
DBecause Redis only supports string members, not numeric scores.
Attempts:
2 left
💡 Hint
Think about how Redis handles data types and communication.
📝 Syntax
advanced
2:00remaining
Which ZSCORE command syntax is correct?
Choose the correct syntax to get the score of member "Charlie" from sorted set "game_scores".
AZSCORE game_scores Charlie
BZSCORE "game_scores" "Charlie"
CZSCORE "game_scores" Charlie
DZSCORE game_scores "Charlie"
Attempts:
2 left
💡 Hint
Member names with special characters or spaces need quotes.
optimization
expert
3:00remaining
How to efficiently check scores of multiple members?
You want to get scores for multiple members in a sorted set efficiently. Which approach is best?
ARun ZSCORE command separately for each member one by one.
BUse ZRANGE with WITHSCORES and filter results client-side.
CUse a Lua script to batch ZSCORE calls in Redis server.
DUse ZSCORE with multiple members in one command.
Attempts:
2 left
💡 Hint
Think about reducing network round-trips and server load.