How would you add an element 'apple' to a set named 'fruits' in Redis?
SADD fruits apple
HSET fruits apple
LPUSH fruits apple
SET fruits apple
What file extension is typically used for Redis's Append-Only File?
.log
.aof
.rdb
.redis
What is the primary difference between a Redis Set and a Redis List?
There is no difference
Sets allow duplicates, Lists do not
Sets do not allow duplicates, Lists allow duplicates
Sets are ordered, Lists are unordered
You want to store a list of a user's recent activity in chronological order. What Redis data type is suitable?
Set
Hash
String
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
An error occurs because you cannot overwrite an expiring key.
The expiration time is retained.
The expiration time is removed, making the key persistent.
The expiration time is reset to its default value.
Which command is used to decrease the value of a key by 1 in Redis?
DECREMENT
DECR
SUB
MINUS
What is a potential drawback of using only RDB snapshots for persistence in Redis?
High memory usage
Complex configuration
Slow write speeds
Potential data loss between snapshots
How do you establish a connection to a Redis server using redis-py?
Redis.create_connection()
redis.connect()
Redis.new()
redis.Redis()
What does the TTL command return for a key that doesn't expire?
TTL
-2
An error message
0
-1
How do you set a key to expire after 20 seconds in Redis?
TIMEOUT key 20
EXPIRE key 20
SETEX key 20 value
PERSIST key 20