Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add an element to the start of a Redis list.
Redis
LPUSH mylist [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using RPUSH instead of LPUSH when adding to the start.
Forgetting to put quotes around the element.
✗ Incorrect
LPUSH adds the specified element to the start (left) of the list. Here, "banana" is added.
2fill in blank
mediumComplete the code to add an element to the end of a Redis list.
Redis
RPUSH mylist [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LPUSH instead of RPUSH when adding to the end.
Not quoting the element string.
✗ Incorrect
RPUSH adds the specified element to the end (right) of the list. Here, "grape" is added.
3fill in blank
hardFix the error in the command to add "kiwi" to the start of the list.
Redis
LPUSH mylist [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the string element.
Using mismatched or incomplete quotes.
✗ Incorrect
The element must be a string enclosed in double quotes. Option D is correct.
4fill in blank
hardFill both blanks to add "lemon" to the start and "mango" to the end of the list.
Redis
LPUSH mylist [1] RPUSH mylist [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the elements between LPUSH and RPUSH.
Forgetting quotes around the elements.
✗ Incorrect
LPUSH adds "lemon" to the start, RPUSH adds "mango" to the end.
5fill in blank
hardFill all three blanks to add "orange" to the start, "pear" to the end, and "plum" to the start again.
Redis
LPUSH mylist [1] RPUSH mylist [2] LPUSH mylist [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of elements.
Using RPUSH when LPUSH is needed and vice versa.
✗ Incorrect
LPUSH adds "orange" and "plum" to the start, RPUSH adds "pear" to the end.