Redis Certified Associate Exam-style mock test
Redis Certified Associate Practice Exams|Practice test
Full explanations
Exam format
Pass line 70%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · Redis Data Structures & Commands
A B2B SaaS billing platform needs to track, per tenant, the exact set of unique feature flags each account has enabled, and must frequently test membership and compute intersections between two tenants' enabled features. Which Redis data structure best fits this requirement?
・A Redis Hash keyed by tenant, storing each feature flag name as a field mapped to a boolean-like string value for lookups
Incorrect. A Hash can store flags as fields, but it offers no native set-intersection operation, so comparing two tenants would require client-side logic.
✓A Redis Set per tenant holding the enabled feature flag names, using SADD, SISMEMBER, and SINTER operations
Correct. A Set guarantees uniqueness, provides O(1) membership via SISMEMBER, and supports server-side intersection with SINTER, matching every stated requirement.
・A Redis List per tenant where feature flag names are pushed and later scanned linearly to check membership
Incorrect. A List allows duplicates and requires linear scanning to test membership, making uniqueness and intersection both inefficient to implement.
・A Redis Sorted Set per tenant where each feature flag is a member scored by its activation timestamp value
Incorrect. A Sorted Set adds unnecessary scoring overhead and ordering that the use case does not need, and has no direct boolean intersection command for plain membership.
Explanation
Sets are purpose-built for unique collections with fast membership and native cross-key intersection (SINTER), which directly serves the feature-flag comparison requirement.
Example2 · Data Modeling & Keys
A B2B SaaS billing platform needs to store each tenant's active feature flags as a set of unique string identifiers so membership checks and additions stay O(1). Which Redis data structure best fits this modeling requirement?
・A Sorted Set keyed per tenant, using the member score to represent the flag's insertion timestamp order
Incorrect. A Sorted Set adds ordering overhead and a required score the model does not need for simple membership testing.
・A Hash keyed per tenant, storing each flag name as a field mapped to a boolean enabled value
Incorrect. A Hash can model flags but introduces field-value pairs when a plain uniqueness-guaranteeing membership structure is enough.
✓A Set keyed per tenant, storing each unique flag identifier as a member value
Correct. A Set guarantees unique members and provides O(1) membership checks and additions, matching the feature-flag requirement exactly.
・A List keyed per tenant, appending each flag identifier and scanning it when a membership check is required
Incorrect. A List allows duplicates and forces O(N) scanning for membership, which is inefficient for this flag-lookup pattern.
Explanation
Sets store unique members and offer constant-time SADD and SISMEMBER operations, making them the natural fit for feature-flag membership modeling.
Example3 · Persistence, Replication & HA
A B2B SaaS billing platform stores invoice totals in Redis and cannot tolerate losing more than one second of writes after a crash. Which persistence configuration best satisfies this durability target?
✓Enable AOF persistence and configure the fsync policy to run once every second so writes are flushed on a one-second cadence
Correct. AOF with appendfsync everysec flushes the log roughly once per second, bounding worst-case data loss to about one second of writes.
・Enable RDB snapshotting on a frequent save interval and disable AOF entirely to reduce the disk overhead on the node
Incorrect. RDB snapshots run on intervals that can span minutes, so a crash between snapshots can lose far more than one second of writes.
・Disable all persistence and instead rely on the replica nodes keeping an in-memory copy of the recent writes
Incorrect. Replicas hold data in memory but are not a persistence mechanism, and a correlated failure still risks losing recent writes.
・Enable AOF persistence and set the fsync policy to never, letting the operating system decide when the buffer is written
Incorrect. The never fsync policy lets the OS flush whenever it chooses, leaving many seconds of writes unflushed and unbounded on crash.
Explanation
AOF with everysec fsync is the standard choice when the durability requirement is bounded to about one second of potential data loss.
Example4 · Performance, Memory & Eviction
A healthcare services firm caches patient lookup results in Redis with a fixed maxmemory limit. Every cached entry has a TTL, and the team wants Redis to evict the least recently accessed keys once memory fills. Which maxmemory-policy should they configure?
・allkeys-lru, which evicts the least recently used key across the entire keyspace when memory is full
Incorrect. allkeys-lru evicts by recency but ignores whether a key has a TTL, so it could drop untracked data too.
✓volatile-lru, which evicts the least recently used key among keys that carry an expiration set
Correct. volatile-lru restricts eviction to keys with a TTL and removes the least recently used among them, matching the design.
・noeviction, which returns errors on writes and keeps every stored key resident in memory
Incorrect. noeviction never removes keys and instead fails writes, which does not provide the desired cache behavior.
・volatile-ttl, which evicts the key with the shortest remaining time to live first
Incorrect. volatile-ttl evicts by shortest remaining TTL rather than by recency of access, so it uses the wrong signal.
Explanation
Because all entries carry a TTL and recency is the desired signal, volatile-lru targets exactly the expiring keys and evicts the least recently used.
Example5 · Security, Clients & Administration
A healthcare services firm runs a standalone Redis instance that currently accepts unauthenticated connections. The security team wants every client to supply a password before issuing commands. Which approach correctly enables password authentication on this instance?
✓Set the requirepass directive in redis.conf (or via CONFIG SET requirepass) so clients must call AUTH with the password
Correct. The requirepass directive sets a server password; clients must then issue AUTH <password> before running other commands.
・Enable the protected-mode directive, which forces every connecting client to supply a password when calling AUTH on the instance
Incorrect. protected-mode only blocks external connections when no password/bind is set; it does not itself require AUTH.
・Define a bind address restriction in redis.conf, after which the server requires each client to present a password token
Incorrect. The bind directive limits which network interfaces accept connections; it does not mandate a password.
・Rename the AUTH command to a secret string so only clients knowing the string can issue commands against the server
Incorrect. Renaming commands obscures a command name but is not the mechanism for enforcing client authentication.
Explanation
Password authentication on a classic instance is enabled with requirepass; clients authenticate with AUTH.
Example6 · Redis Data Structures & Commands
A healthcare services firm stores each patient's current vital signs (heart rate, blood pressure, temperature) as named fields under one key per patient, and must read or update a single field without rewriting the others. Which Redis data structure best fits this requirement?
✓A Hash, which maps field names to values under one key and lets you read or write individual fields independently
Correct. A Hash stores multiple named fields under a single key, so HGET and HSET operate on one field at a time without touching the others.
・A sorted set, which keeps members ordered by a numeric score and supports fast range queries over that ordering
Incorrect. A sorted set orders members by score and is suited to ranking or range queries, not to named-field record storage.
・A List, which stores an ordered sequence of values accessed by position from either end of the collection
Incorrect. A List is an ordered sequence addressed by index or ends, which does not model named fields of a record.
・A plain String holding a serialized JSON blob of all of the patient's vital-sign fields together
Incorrect. A serialized JSON String forces a full read-modify-write of every field for any single-field update, defeating the requirement.
Explanation
Named fields under one key with independent per-field access is the defining use case for a Redis Hash.
Example7 · Redis Data Structures & Commands
The engineering team at UrbanThread, an online apparel retailer, needs to store each shopper's cart as a set of field-value pairs (product SKU to quantity) under a single key so individual fields can be read and updated without rewriting the whole cart. Which Redis data structure best fits this requirement?
✓A Hash, which stores a mapping of fields to values under one key and supports per-field get and set operations
Correct. A Hash maps fields (SKUs) to values (quantities) under one key and allows HGET/HSET on individual fields without rewriting the cart.
・A Sorted Set, which stores members with scores and keeps them ordered for fast range and rank queries
Incorrect. A Sorted Set orders members by numeric score and is suited to leaderboards or ranges, not field-value cart mappings.
・A List, which stores an ordered sequence of string elements accessible from either end of the collection
Incorrect. A List keeps an ordered sequence of elements but has no concept of named fields for per-field updates.
・A plain String holding the entire cart serialized as one JSON document under a single key
Incorrect. A serialized String requires reading and rewriting the whole document to change one field, defeating per-field updates.
Explanation
Hashes are designed for objects composed of field-value pairs, enabling efficient reads and writes of individual fields.
Example8 · Redis Data Structures & Commands
UrbanThread wants to track the distinct product IDs a shopper has viewed during a session so that no product ID is recorded more than once and membership can be tested quickly. Which Redis data structure should the developers use?
・A List, appending each viewed product ID in order so the full browsing history can be replayed later
Incorrect. A List allows duplicate entries and does not enforce uniqueness of the product IDs stored.
✓A Set, which stores unordered unique members and rejects duplicate insertions automatically for fast membership checks
Correct. A Set stores unique, unordered members, automatically ignores duplicates, and supports O(1) membership testing with SISMEMBER.
・A Hash with product IDs as fields and view timestamps as values stored together under a single key
Incorrect. A Hash could enforce unique fields but adds unneeded value storage and is not the idiomatic uniqueness structure.
・A Set
Incorrect. While a Set is the right type, this stub gives no justification and is not a complete, comparable answer statement.
Explanation
Sets enforce member uniqueness and offer constant-time membership tests, making them ideal for tracking distinct viewed items.
Example9 · Redis Data Structures & Commands
UrbanThread maintains a real-time best-sellers board where each product's rank is driven by its running sales count. When a product sells, the team must increment its score and keep the board ordered. Which command correctly increases a member's score within a sorted set?
・HINCRBY, which increments a numeric field stored inside a hash key by the given integer amount
Incorrect. HINCRBY operates on hash fields, not on the scores that order members within a sorted set.
・INCRBY, which increments the integer value of a standalone string key by the specified amount
Incorrect. INCRBY increments a plain string key's integer value and has no effect on sorted set ordering.
✓ZINCRBY, which increments the score of a specified member in a sorted set and reorders it
Correct. ZINCRBY adds a delta to a member's score in a sorted set, automatically repositioning it in rank order.
・ZADD GT, adding the member again and updating its score only when the new score is greater
Incorrect. ZADD GT sets an absolute score conditionally rather than incrementing the existing sales count directly.
Explanation
ZINCRBY is purpose-built to atomically adjust a sorted set member's score and keep ordering current.
Example10 · Redis Data Structures & Commands
A financial services firm stores each customer's brokerage account profile (name, tier, balance currency, and risk flag) under one key and frequently updates only the risk flag. Which Redis data type lets them update that single field without rewriting the whole profile?
・A sorted set, keeping each profile attribute as a member scored by its last-updated epoch timestamp value
Incorrect. A sorted set orders members by numeric score and offers no named-field update, so editing one attribute is awkward and loses the key-value structure.
✓A hash, storing each attribute as a separate field so individual fields can be read or updated
Correct. A hash maps field names to values under one key, so HSET on the risk flag updates just that field without touching the others.
・A string, holding the serialized JSON profile that is replaced in full on every single edit
Incorrect. A string stores one opaque blob, forcing the firm to deserialize, edit, and rewrite the entire profile for any single change.
・A list, appending each attribute value in a fixed positional order for later retrieval by index
Incorrect. A list is an ordered sequence without named fields, so updating one attribute means tracking positions and rewriting by index.
Explanation
Hashes model object-like records with independently addressable fields, ideal when only part of a record changes frequently.
Example11 · Redis Data Structures & Commands
A trading platform maintains a real-time leaderboard of traders ranked by daily profit, where the profit value changes constantly. Which Redis data type and operation best supports both fast updates and ordered top-N retrieval?
✓A sorted set, using ZADD to set each trader's profit as the score and ZREVRANGE to read the ranked top entries
Correct. A sorted set keeps members ordered by score, so ZADD updates a trader's profit and ZREVRANGE returns the ranked leaders efficiently.
・A hash of trader-to-profit fields, then sorting all fields in the client application whenever a leaderboard view is requested
Incorrect. A hash has no ordering, forcing the client to pull and sort all fields on every leaderboard request, which does not scale.
・A list of trader entries, re-sorting the entire list on the server after each profit change happens
Incorrect. A list has no score-based ordering, so re-sorting the whole list on each change is costly and error-prone.
・A set of trader IDs, computing ranks by scanning every member and comparing profits on demand
Incorrect. A set is unordered, so ranks require a full scan and comparison of every member each time they are needed.
Explanation
Sorted sets maintain score ordering intrinsically, making them the natural fit for leaderboards with frequent score updates and ranked reads.
Example12 · Redis Data Structures & Commands
A manufacturing distributor stores each warehouse order as a record with fields like status, carrier, and weight that are frequently read and updated independently. Which Redis data type stores this order most efficiently for field-level access?
✓A Hash keyed by the order id, with each attribute stored as a separate field for direct reads and writes
Correct. A Hash maps field names to values under one key, letting the distributor read or update status or carrier individually without touching the rest.
・A List keyed by the order id, pushing each attribute value in a fixed positional order
Incorrect. A List only tracks positional order and offers no named field access, so updating one attribute means tracking fragile index positions.
・A String keyed by the order id, holding the whole record serialized as a single JSON document
Incorrect. A serialized String forces a full read-modify-write of the entire document just to change one attribute like status.
・A Sorted Set keyed by the order id, scoring each attribute so values can be ranged
Incorrect. A Sorted Set orders members by numeric score and is not a container for a named set of heterogeneous attributes.
Explanation
Hashes are purpose-built for objects whose named fields are accessed independently, which fits an order record read and updated field by field.
Example13 · Redis Data Structures & Commands
The distributor needs a strictly increasing shipment tracking number that multiple warehouse clients request concurrently, with no two clients ever receiving the same value. Which approach guarantees a unique sequence under concurrency?
・Call GET on the counter, add one in the client, and then write the new value back with SET before replying
Incorrect. A GET then SET sequence is a race across clients, so two of them can read the same value and hand out duplicate numbers.
✓Call INCR on a single counter key so each client receives its own atomically incremented value
Correct. INCR atomically increments and returns the new value in one operation, so each concurrent caller gets a distinct number.
・Call APPEND on a String and measure its resulting length to derive the next tracking number
Incorrect. APPEND grows the String by bytes and its length does not model a monotonic numeric sequence for tracking ids.
・Call SETNX repeatedly with a guessed next value until one of the attempts finally succeeds
Incorrect. Guessing values with repeated SETNX is wasteful and still races between the probe and the write under load.
Explanation
INCR is a single atomic server-side operation, which is exactly how Redis provides contention-free unique counters.
Example14 · Redis Data Structures & Commands
A telecom operator tracks, per subscriber, the set of unique cell towers a device has connected to during the day, and must frequently check whether a given tower is already present for that subscriber. Which Redis data structure best models this requirement?
・A Redis List per subscriber, appending each tower id and scanning the list to test whether a tower already appears in the device's history
Incorrect. Lists allow duplicates and require an O(N) scan to test membership, which is inefficient for uniqueness checks.
・A Redis Hash per subscriber, mapping each tower id to a timestamp and reading the whole hash to decide if the tower is present
Incorrect. A hash can enforce uniqueness but is heavier than needed when only presence of a member matters, not an associated value.
✓A Redis Set per subscriber, storing tower ids as members and using membership checks to test presence
Correct. Sets store unique members and provide O(1) membership testing, exactly matching the uniqueness-and-presence requirement.
・A Redis Sorted Set per subscriber, scoring each tower id and ranging over scores to confirm the tower was seen
Incorrect. Sorted sets add ordering by score that the workload does not need, adding overhead without benefit for simple presence checks.
Explanation
Sets are the natural fit for collections of unique values where fast membership testing is the primary operation.
Example15 · Redis Data Structures & Commands
The telecom operator maintains a live leaderboard of cell towers ranked by current active call count, and needs to fetch the ten busiest towers instantly at any moment. Which approach fits this requirement best?
✓Store each tower in a sorted set with its active call count as the score and query the top range by descending score
Correct. A sorted set keeps members ordered by score, so the busiest towers are retrievable directly as a top-N range in logarithmic time.
・Store towers in a hash keyed by tower id with call counts as values, then sort them in the client on every request
Incorrect. A hash has no inherent ordering, forcing an expensive full client-side sort on every leaderboard request.
・Store towers in a list in arrival order and re-sort the full list by call count whenever the top ten is needed
Incorrect. Lists preserve insertion order, not score order, so re-sorting the entire list each read is costly and error-prone.
・Store towers in a set and recompute the ranking from a separate counters hash each time the leaderboard is read
Incorrect. Sets are unordered, so recomputing the ranking from separate counters on each read defeats the purpose of fast access.
Explanation
Sorted sets maintain members ordered by score, making ranked queries such as top-N leaderboards efficient.
▶ Try 10 free questions (graded)