0
0
Redisquery~10 mins

Why hashes represent objects in Redis - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a field 'name' with value 'Alice' in a Redis hash.

Redis
HSET user:1000 [1] Alice
Drag options to blanks, or click blank then click option'
Aname
Buser
C1000
Dfield
Attempts:
3 left
💡 Hint
Common Mistakes
Using the hash key instead of the field name.
Confusing the field with the value.
2fill in blank
medium

Complete the code to retrieve the value of the field 'age' from the Redis hash 'user:1000'.

Redis
HGET user:1000 [1]
Drag options to blanks, or click blank then click option'
Aage
Buser
C1000
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using the hash key instead of the field name.
Using a value instead of a field.
3fill in blank
hard

Fix the error in the code to get all fields and values from the hash 'user:1000'.

Redis
[1] user:1000
Drag options to blanks, or click blank then click option'
AHGET
BGETALL
CGET
DHGETALL
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET or GETALL which are for strings, not hashes.
Using HGET which returns only one field.
4fill in blank
hard

Fill both blanks to set multiple fields 'name' and 'age' in the hash 'user:1000'.

Redis
HMSET user:1000 [1] [2]
Drag options to blanks, or click blank then click option'
Aname Alice
Bage 30
Cname Bob
Dage 25
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong field names or values.
Putting both field and value in one option incorrectly.
5fill in blank
hard

Fill all three blanks to create a hash 'user:1000' with fields 'name', 'age', and 'email'.

Redis
HMSET user:1000 [1] [2] [3]
Drag options to blanks, or click blank then click option'
Aname Alice
Bage 30
Cemail alice@example.com
Dphone 123456
Attempts:
3 left
💡 Hint
Common Mistakes
Including unrelated fields like 'phone'.
Mixing field names and values incorrectly.