Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a string value for a key in Redis.
Redis
SET user:1000 [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting string values causes errors.
Using a key name as the value.
✗ Incorrect
The SET command stores a string value. The value must be quoted if it contains spaces or special characters.
2fill in blank
mediumComplete the code to set a field in a Redis hash.
Redis
HSET user:1000 [1] "John"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the key name as the field.
Confusing field and value.
✗ Incorrect
The HSET command sets a field in a hash. The field name here is name.
3fill in blank
hardFix the error in the command to get a field from a Redis hash.
Redis
HGET user:1000 [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the key name instead of the field.
Using the value instead of the field.
✗ Incorrect
The HGET command requires the field name to retrieve its value from the hash.
4fill in blank
hardFill both blanks to set multiple fields in a Redis hash.
Redis
HMSET user:1000 [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using key names instead of field-value pairs.
Not pairing fields with values.
✗ Incorrect
The HMSET command sets multiple fields and values in a hash. Each field and its value are paired.
5fill in blank
hardFill all three blanks to retrieve multiple fields from a Redis hash.
Redis
HMGET user:1000 [1] [2] [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the key name as a field.
Not listing multiple fields.
✗ Incorrect
The HMGET command retrieves multiple fields from a hash. You list the fields you want.