0
0
Redisquery~10 mins

Why sorted sets solve ranking problems in Redis - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a member with a score to a sorted set in Redis.

Redis
ZADD leaderboard 1500 [1]
Drag options to blanks, or click blank then click option'
AZADD
B1500
Cscore
Dplayer1
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the member name before the score.
Using a string instead of a number for the score.
2fill in blank
medium

Complete the code to retrieve the top 3 members with the highest scores from the sorted set.

Redis
ZREVRANGE leaderboard 0 [1] WITHSCORES
Drag options to blanks, or click blank then click option'
A3
B1
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 3 as the end index, which returns 4 members.
Using ZRANGE instead of ZREVRANGE for highest scores.
3fill in blank
hard

Fix the error in the code to get the rank of 'player5' in ascending order.

Redis
ZRANK leaderboard [1]
Drag options to blanks, or click blank then click option'
Aplayer5
B5
Crank
Dplayer
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number instead of the member name.
Confusing ZRANK with ZREVRANK.
4fill in blank
hard

Fill both blanks to increment the score of 'player3' by 100 in the sorted set.

Redis
ZINCRBY leaderboard [1] [2]
Drag options to blanks, or click blank then click option'
A100
Bplayer3
C150
Dplayer1
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the increment and member arguments.
Using a member name that does not exist.
5fill in blank
hard

Fill both blanks to remove members with scores between 1000 and 2000 from the sorted set.

Redis
ZREMRANGEBYSCORE leaderboard [1] [2]
Drag options to blanks, or click blank then click option'
A1000
B2000
C-inf
D+inf
Attempts:
3 left
💡 Hint
Common Mistakes
Using -inf or +inf incorrectly.
Swapping the min and max values.