0
0
Redisquery~10 mins

LPOP and RPOP for removal 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 remove and return the first element from the list stored at key.

Redis
redis.call('[1]', 'mylist')
Drag options to blanks, or click blank then click option'
ARPOP
BPOP
CLPOP
DREMOVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using RPOP instead of LPOP removes from the right side.
Using POP or REMOVE commands which do not exist in Redis.
2fill in blank
medium

Complete the code to remove and return the last element from the list stored at key.

Redis
redis.call('[1]', 'mylist')
Drag options to blanks, or click blank then click option'
ARPOP
BLPOP
CPOP
DDEL
Attempts:
3 left
💡 Hint
Common Mistakes
Using LPOP instead of RPOP removes from the left side.
Using POP or DEL commands which do not remove list elements.
3fill in blank
hard

Fix the error in the code to correctly remove the first element from the list 'tasks'.

Redis
redis.call('[1]', 'tasks')
Drag options to blanks, or click blank then click option'
ADEL
BPOP
CREMOVE
DLPOP
Attempts:
3 left
💡 Hint
Common Mistakes
Using POP or REMOVE which are invalid commands.
Using DEL which deletes the whole key, not an element.
4fill in blank
hard

Fill both blanks to remove the last element from 'queue' and the first element from 'stack'.

Redis
redis.call('[1]', 'queue')
redis.call('[2]', 'stack')
Drag options to blanks, or click blank then click option'
ARPOP
BLPOP
CDEL
DPOP
Attempts:
3 left
💡 Hint
Common Mistakes
Using DEL deletes the entire key, not an element.
Using POP which is not a Redis list command.
5fill in blank
hard

Fill all three blanks to remove the first element from 'list1', the last element from 'list2', and the first element from 'list3'.

Redis
redis.call('[1]', 'list1')
redis.call('[2]', 'list2')
redis.call('[3]', 'list3')
Drag options to blanks, or click blank then click option'
ARPOP
BLPOP
DDEL
Attempts:
3 left
💡 Hint
Common Mistakes
Using DEL instead of LPOP or RPOP.
Mixing up LPOP and RPOP commands.