Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a key with a value in Redis.
Redis
SET mykey [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values
Using unsupported data types as values
✗ Incorrect
The SET command requires the value to be a string, but Redis does not require quotes around simple strings without spaces.
2fill in blank
mediumComplete the code to retrieve the value of a key in Redis.
Redis
GET [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the value instead of the key
Using a generic word instead of the actual key
✗ Incorrect
The GET command requires the key name to retrieve its value.
3fill in blank
hardFix the error in the command to delete a key in Redis.
Redis
DEL [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around the key name
Using the value instead of the key
✗ Incorrect
The DEL command requires the key name without quotes to delete it.
4fill in blank
hardFill both blanks to set a key with expiration time in seconds.
Redis
SET [1] [2] EX 10
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the key name
Not quoting the string value
✗ Incorrect
The first blank is the key name, and the second blank is the string value in quotes.
5fill in blank
hardFill all three blanks to increment a counter key by 1 and get its new value.
Redis
INCRBY [1] [2]; GET [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different keys for increment and get
Using a number other than 1 for increment
✗ Incorrect
INCRBY increments the key by the number given, then GET retrieves the updated value.