Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a key-value pair in Redis.
Redis
SET [1] "Hello"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Redis commands like GET or DEL as keys.
Leaving the key blank.
✗ Incorrect
The SET command stores a key with a value in Redis. Here, mykey is the 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 to retrieve data.
Using DEL which deletes keys.
✗ Incorrect
The GET command retrieves the value stored at the given key.
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 commands like GET or SET as arguments to DEL.
Not specifying the key to delete.
✗ Incorrect
The DEL command deletes the specified key. Here, mykey is the key to delete.
4fill in blank
hardFill both blanks to set a key with an expiration time in seconds.
Redis
SET [1] "value" [2] 60
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using PX which sets expiration in milliseconds instead of seconds.
Omitting the expiration option.
✗ Incorrect
The SET command with EX sets the key to expire after the given seconds (60 here). mykey is the key name.
5fill in blank
hardFill the blanks to increment a numeric key by 5.
Redis
[1] [2] 5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like XX or NX, which apply to SET not INCRBY.
Using wrong command instead of INCRBY.
✗ Incorrect
INCRBY increments the numeric key mycounter by 5.