01Predict the lifecycle of this sequence: `MULTI`, valid `SET`, wrong-arity `GET`, `EXEC`. Which phase detects the problem?introScenarioA client walks through a transaction that contains one well-formed command and one with the wrong number of arguments.AMULTI enters transaction mode, the valid SET queues, the wrong-arity GET is detected while building the queue, and EXEC aborts or returns the queued-error outcome.BEvery check waits for EXEC, where the wrong-arity GET fails mid-batch and the commands after it are skipped — the queue stays deliberately opaque until the whole batch is visible, so checks can span commands.CThe wrong-arity GET is silently dropped from the queue, and EXEC runs the lone SET successfully.DMULTI validates the upcoming commands when it starts, so the error surfaces before the GET is even sent.
02Predict the reply shape when `EXEC` runs three queued commands and the middle command hits a wrong-type error.introScenarioThree commands were queued and EXEC runs them, but the second targets a key of the wrong type.AEXEC returns one error reply and rolls back the effect of the first command before any client sees it.BEXEC stops at the failure, returning two replies and leaving the third command unexecuted in the queue, which the client can resubmit after fixing the failing command in isolation.CEXEC returns an array with one reply per queued command, including a wrong-type error in the middle position rather than rolling back earlier replies.DEXEC returns nil, exactly as it does when a watched key was modified before execution.
03Why does `WATCH balance` not lock `balance` against other clients?appliedScenarioA client WATCHes a balance key, reads it, and prepares a MULTI block while other clients stay active.AWATCH takes a shared lock that other readers can hold too, upgrading to exclusive only at EXEC.BWATCH locks the key against writes while still permitting reads, like a reader-writer lock.CWATCH blocks other clients' writes only between MULTI and EXEC, a window kept deliberately short to minimize contention on heavily written keys.DWATCH marks the transaction dirty if another client changes the key; it does not lock or block that other client.
04What state belongs on the client while a transaction is being built?appliedScenarioA connection is halfway through building a transaction, and you are auditing what the server holds for it.AOnly the MULTI flag, since the queued commands live in the database where EXEC can find them.BThe client owns transaction mode, the queued commands, watched keys, dirty state, and cleanup state until EXEC or DISCARD.CThe queue plus a snapshot of every watched key's value, so EXEC can compare bytes to detect conflicts.DNothing at all, because the client library batches commands locally and ships them with the final EXEC in one network burst, the same trick pipelining uses.
05Compare pipelining, `MULTI/EXEC`, and scripts for round trips, interleaving, and branching.advancedScenarioYou must pick a mechanism for a multi-step operation and are weighing the three batching tools the server offers.AAll three are atomic, and they differ only in how many round trips each one saves.BMULTI/EXEC supports branching on intermediate replies, because each queued command returns its value at queue time.CPipelining saves round trips without atomicity, MULTI/EXEC queues commands without branching on intermediate results, and scripts run atomically with server-side branching.DScripts save the most round trips but cannot write keys, so atomic writes still require MULTI/EXEC.