0
0
Redisquery~10 mins

LINDEX for position access 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 the element at index 2 from the list 'mylist'.

Redis
LINDEX mylist [1]
Drag options to blanks, or click blank then click option'
A2
B1
C3
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 1 instead of 2, which returns the second element.
Using negative index when positive index is needed.
2fill in blank
medium

Complete the code to get the last element from the list 'tasks'.

Redis
LINDEX tasks [1]
Drag options to blanks, or click blank then click option'
A-1
B0
C1
D-2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 which returns the first element instead of the last.
Using -2 which returns the second last element.
3fill in blank
hard

Fix the error in the code to correctly get the first element of the list 'queue'.

Redis
LINDEX queue [1]
Drag options to blanks, or click blank then click option'
A1
B2
C-1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 which returns the second element.
Using -1 which returns the last element.
4fill in blank
hard

Fill both blanks to get the element at index 3 from the list 'events' and the element at index -2 from the list 'logs'.

Redis
LINDEX events [1]
LINDEX logs [2]
Drag options to blanks, or click blank then click option'
A3
B-1
C-2
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using -1 instead of -2 for the second last element.
Using 2 instead of 3 for the fourth element.
5fill in blank
hard

Fill all three blanks to get the first element from 'list1', the last element from 'list2', and the element at index 4 from 'list3'.

Redis
LINDEX list1 [1]
LINDEX list2 [2]
LINDEX list3 [3]
Drag options to blanks, or click blank then click option'
A0
B-1
C4
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 for the first element.
Using 0 instead of -1 for the last element.
Using 5 instead of 4 for the fifth element.