Challenge - 5 Problems
Lexicographic Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this ZRANGEBYLEX query?
Given a sorted set
myzset with members a, b, c, d, and e, what does the command ZRANGEBYLEX myzset [b [d return?Redis
ZRANGEBYLEX myzset [b [d
Attempts:
2 left
💡 Hint
Remember that square brackets mean inclusive range in lexicographic queries.
✗ Incorrect
The command returns all members from 'b' to 'd' inclusive, so it includes 'b', 'c', and 'd'.
📝 Syntax
intermediate2:00remaining
Which ZRANGEBYLEX command is syntactically correct?
Choose the syntactically valid ZRANGEBYLEX command to get members lexicographically between 'a' (exclusive) and 'c' (inclusive).
Attempts:
2 left
💡 Hint
Parentheses mean exclusive, square brackets mean inclusive in ZRANGEBYLEX.
✗ Incorrect
Option D correctly uses (a for exclusive start and [c for inclusive end, matching the requirement.
❓ optimization
advanced2:00remaining
How to optimize a ZRANGEBYLEX query for large sorted sets?
You want to retrieve members lexicographically between 'm' and 'z' from a very large sorted set. Which approach optimizes performance best?
Attempts:
2 left
💡 Hint
Fetching large ranges at once can be slow; pagination helps.
✗ Incorrect
Using LIMIT with ZRANGEBYLEX paginates results, reducing memory and network load.
🔧 Debug
advanced2:00remaining
Why does this ZRANGEBYLEX command return an empty list?
Given a sorted set with members 'apple', 'banana', 'cherry', 'date', why does
ZRANGEBYLEX myzset (banana (cherry return an empty list?Attempts:
2 left
💡 Hint
Parentheses exclude the boundary members.
✗ Incorrect
The range excludes 'banana' and 'cherry' and no other members are lexicographically between them.
🧠 Conceptual
expert2:00remaining
What is the difference between ZRANGEBYLEX and ZRANGEBYSCORE?
Which statement best describes the difference between ZRANGEBYLEX and ZRANGEBYSCORE commands in Redis sorted sets?
Attempts:
2 left
💡 Hint
Think about what 'lex' and 'score' mean.
✗ Incorrect
ZRANGEBYLEX uses the member strings' lexicographic order ignoring scores; ZRANGEBYSCORE uses numeric scores.