Practice & Assessment
Test your understanding of Core Commands and Data Structures
Multiple Choice Questions
5Which command atomically increments a Redis String value and returns the new value?
What is the time complexity of SISMEMBER on a Redis Set?
Which command would you use to implement a job queue where a worker waits for work?
ZADD leaderboard GT 800 'alice' — when does this update alice's score?
Which command returns all members of a Hash including field names?
Coding Challenges
1Real-Time Leaderboard
Build a function (any language) that accepts an array of (playerName, score) tuples, stores them in a Redis Sorted Set called 'game:scores', and returns the top 10 players with their scores in descending order. Also implement a function addScore(player, points) that increments a player's score by points using ZINCRBY. Input: list of (string, integer) pairs. Output: ordered list of (string, float) pairs. Estimated time: 20 minutes.
Mini Project
Product Tag and Search System
Build a CLI tool that manages products. Each product has an id, name, price (stored as a Hash). Products belong to tags (stored as Sets, one Set per tag). Implement: addProduct(id, name, price, tags[]) — stores the hash and adds the product id to each tag's Set; searchByTag(tag) — returns all product names for that tag; searchByTags(tag1, tag2) — returns product names matching BOTH tags using SINTER; topProducts(n) — maintains a Sorted Set 'products:views' and returns the top N most-viewed products using ZREVRANGE. Increment the view count each time a product is retrieved.
