0
0
Redisquery~10 mins

Accessing keys and arguments 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 access the first key in a Redis Lua script.

Redis
local key1 = KEYS[[1]]
Drag options to blanks, or click blank then click option'
A1
B0
C2
Dkey
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the index which causes an error.
Trying to access keys by name instead of index.
2fill in blank
medium

Complete the code to access the second argument passed to the Redis Lua script.

Redis
local arg2 = ARGV[[1]]
Drag options to blanks, or click blank then click option'
A2
Barg
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as index which is invalid in Lua.
Confusing KEYS and ARGV tables.
3fill in blank
hard

Fix the error in accessing the first key in the script.

Redis
local firstKey = KEYS[[1]]
Drag options to blanks, or click blank then click option'
Afirst
B0
Ckey1
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as index causing nil value.
Using string keys instead of numeric indices.
4fill in blank
hard

Fill both blanks to get the third key and the first argument in the script.

Redis
local thirdKey = KEYS[[1]]
local firstArg = ARGV[[2]]
Drag options to blanks, or click blank then click option'
A3
B1
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as index which is invalid.
Mixing up keys and arguments indices.
5fill in blank
hard

Fill all three blanks to get the second key, the third argument, and the first key in the script.

Redis
local secondKey = KEYS[[1]]
local thirdArg = ARGV[[2]]
local firstKey = KEYS[[3]]
Drag options to blanks, or click blank then click option'
A1
B3
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as index causing errors.
Confusing keys and arguments indices.