Which command would you use to retrieve the value associated with the key 'username' in Redis?
HGET username
GET username
SET username
LPUSH username
What is the correct way to set a key-value pair named 'mykey' with the value 'myvalue' using redis-py?
r.set('mykey', 'myvalue')
r.put('mykey', 'myvalue')
r.insert('mykey', 'myvalue')
r.assign('mykey', 'myvalue')
Which data type would you use to implement a leaderboard where scores are constantly updated?
Hash
Sorted Set
Set
List
Which command is used to download and install Redis on a Debian-based Linux system?
wget redis.com
brew install redis
apt-get install redis
yum install redis
What Redis command would you use to change the name of a key from 'user:123' to 'customer:123'?
CHANGE
ALTER
RENAME
UPDATE
How can you delete a key named 'mykey' from Redis using redis-py?
r.clear('mykey')
r.delete('mykey')
r.remove('mykey')
r.erase('mykey')
Which method is used to check if a key exists in a Redis database using redis-py?
r.check('mykey')
r.contains('mykey')
r.has_key('mykey')
r.exists('mykey')
Which command is used to decrease the value of a key by 1 in Redis?
SUB
DECREMENT
DECR
MINUS
What is the purpose of the SADD command in Redis?
SADD
Retrieves a value from a hash.
Adds an element to a sorted set.
Adds an element to a set only if it doesn't already exist.
Adds an element to the beginning of a list.
You have a key with an expiration time set. If you overwrite this key with a new value using SET, what happens to the expiration?
SET
The expiration time is removed, making the key persistent.
The expiration time is reset to its default value.
An error occurs because you cannot overwrite an expiring key.
The expiration time is retained.