01A client sends `SET name Ada`, then another client sends `GET name`. Which piece of server state makes the second command see the first command's effect?introScenarioTwo different connections interact with the same key moments apart on one server.AThe replication stream carries the SET over to the session that issued the GET command.BThe shared server-owned keyspace, usually a DB dictionary entry for name, makes the later GET observe the SET.CThe first client's connection state holds the value until another client asks the server for it, releasing it once the read completes.DThe AOF file provides it, since GET replays recent writes from the log before reading memory.
02A beginner stores raw byte arrays directly in the keyspace. What becomes harder to add later: multiple value types or clean command-specific behavior? Explain the dependency.introScenarioA from-scratch implementation stores whatever bytes arrive directly into its dictionary with no wrapper around them.ACommand behavior becomes harder first, because raw byte arrays cannot hold strings longer than a memory page, forcing large values to be chunked across multiple entries.BNeither becomes harder, since the type of any value can be inferred from its content whenever needed.CMultiple value types become harder because raw byte arrays leave no object header for logical type, encoding, or type-specific handlers.DTTLs become impossible, because expiration metadata has nowhere to live without an object header.
03Predict the reply difference between `GET missing` and `GET empty-string-key`. Why must these be distinct?appliedScenarioOne key was never created, and another was explicitly set to a zero-length string; a client reads both.ABoth return null, because an empty value and a missing key describe the same logical state.BGET missing returns an error reply, since only keys that exist can produce bulk strings.CThey differ only in how redis-cli displays them, while both travel the wire as a zero-length bulk string.DGET missing returns a null bulk reply, while an existing empty string returns a zero-length bulk string; absence and an empty value must remain distinct.
04A command handler parses socket bytes and writes directly to the socket. Which boundaries from the lesson has it crossed?appliedScenarioCode review finds a command handler that reads bytes off the socket itself and writes its reply straight back to the file descriptor.AThe handler has crossed parsing and transport boundaries; parsing belongs before dispatch and socket writing belongs after reply serialization or buffering.BIt has crossed no boundaries, because a handler rightfully owns its command from first byte to last — splitting the work across layers only adds latency between socket and keyspace.CIt crossed the persistence boundary, since bytes written straight to a socket can never reach the AOF.DIt crossed the keyspace boundary, because reading input is a state change that only the database layer may perform.
05State the invariant the database should satisfy immediately before a command reply is queued.advancedScenarioYou are writing the one-sentence contract that relates keyspace state to the moment a reply is queued.AThe reply must already be flushed to the client's socket before the database is allowed to mutate.BThe database must still be unchanged, with the mutation applied lazily after the client acknowledges the reply.CThe database must hold a lock on the affected keys until the client has read the queued reply, releasing the lock early only for read-only commands.DBefore queuing the reply, the database should already reflect the complete command effect or the complete read decision for that command.