Hashes, Lists & Sorted Sets

Preview — 3 of 10 questions

What is the correct command to set multiple fields in a Redis Hash at once?

AHSETMANY user:1 {name: "Alice", age: 30}
BHMSET user:1 name "Alice" age 30 email "alice@example.com" (HMSET is the only multi-field option)
CHSET user:1 name "Alice" age 30 email "alice@example.com" (single HSET with multiple field-value pairs)
DSET user:1 name "Alice"; SET user:1 age 30 (separate SET commands)

How do you implement a reliable FIFO queue using Redis Lists?

ARPUSH queue item to enqueue at the tail; LPOP queue to dequeue from the head (FIFO)
BLPUSH queue item to enqueue; LPOP queue to dequeue (LIFO stack behavior)
CSADD queue item to enqueue; SPOP queue to dequeue
DRedis Lists cannot implement FIFO queues; use Sorted Sets instead

What is the difference between SUNION and SINTER for Redis Sets?

ASUNION returns elements in both sets; SINTER returns elements in either set
BSUNION returns all elements from all provided sets (union); SINTER returns only elements that appear in ALL provided sets (intersection)
CSUNION is for sorted sets; SINTER is for unordered sets
DThey are identical but SINTER is faster for small sets

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.