0
0
Redisquery~10 mins

SRANDMEMBER for random elements in Redis - Interactive Code Practice

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

Complete the code to get one random member from the set 'colors'.

Redis
SRANDMEMBER [1]
Drag options to blanks, or click blank then click option'
Acolors
Brandom
Cmembers
Dset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'random' instead of the set name.
Using 'members' which is not a valid argument here.
Using 'set' which is a keyword, not the set name.
2fill in blank
medium

Complete the code to get 3 random members from the set 'fruits'.

Redis
SRANDMEMBER [1] 3
Drag options to blanks, or click blank then click option'
Arandom
Bfruits
Cmembers
Dset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'random' instead of the set name.
Using 'members' which is not the set name.
Using 'set' which is a keyword, not the set name.
3fill in blank
hard

Fix the error in the command to get 2 random members from the set 'animals'.

Redis
SRANDMEMBER animals [1]
Drag options to blanks, or click blank then click option'
A2
B-2
Ctwo
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word 'two' instead of the number 2.
Using negative numbers when positive count is needed.
Using 'count' as a literal argument.
4fill in blank
hard

Fill both blanks to get 2 unique random members from the set 'cities'.

Redis
SRANDMEMBER [1] [2]
Drag options to blanks, or click blank then click option'
Acities
B-2
C2
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using negative count which allows duplicates.
Using wrong set name.
Using zero or negative numbers incorrectly.
5fill in blank
hard

Fill both blanks to get 3 random members from the set 'numbers', allowing duplicates.

Redis
SRANDMEMBER [1] [2]
Drag options to blanks, or click blank then click option'
Anumbers
B-3
C3
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive count which returns unique members only.
Using wrong set name.
Using zero or positive numbers incorrectly.