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
Using a command like GET or DEL instead of a value.
Leaving the value blank.
✗ Incorrect
The SET command stores the given value under the specified key.
2fill in blank
mediumComplete the code to retrieve the value of a key in Redis.
Redis
[1] mykey Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET instead of GET.
Using DEL which deletes the key.
✗ Incorrect
The GET command fetches the value stored at the given key.
3fill in blank
hardFix the error in the code to delete a key in Redis.
Redis
[1] mykey Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET or SET which do not delete keys.
Using EXPIRE which only sets a timeout.
✗ Incorrect
The DEL command removes the key and its value from Redis.
4fill in blank
hardFill both blanks to set a key with an expiration time of 60 seconds.
Redis
SET [1] [2] EX 60
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping key and value positions.
Using a wrong value or key name.
✗ Incorrect
First, specify the key name, then the value to store. The EX 60 sets the key to expire after 60 seconds.
5fill in blank
hardFill all three blanks to increment a counter key by 1 and get its new value.
Redis
[1] [2] [3] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong commands or missing the key name.
Trying to increment a non-integer key.
✗ Incorrect
The INCR command increases the integer value of the key by 1. Then GET retrieves the updated value.