Discover how Cassandra manages data reliability and availability with this quiz on consistency levels. Improve your understanding of consistency concepts, tunable settings, and real-world scenarios essential for scalable distributed databases.
Which consistency level in Cassandra ensures that a write must be acknowledged by at least one replica before it is considered successful?
Explanation: The ONE consistency level acknowledges a write as successful when at least one replica node confirms the write operation. ALL requires all replicas to acknowledge, making it stricter than ONE. TWO is not a standard option—QUORUM or THREE are valid alternatives. ZERO does not guarantee data is written to any replica, making it unsuitable for normal acknowledgements.
What does the QUORUM consistency level require in a cluster with five replicas?
Explanation: QUORUM means that more than half the replicas (three out of five) must agree for the operation to succeed. ALL would need all five to respond. ONE only requires one replica, and two is not enough for a majority in this scenario—hence two is incorrect.
If a Cassandra cluster spans multiple data centers, which consistency level only requires acknowledgement from a majority of replicas in the local data center?
Explanation: LOCAL_QUORUM focuses on the local data center, ensuring faster responses and reducing cross-datacenter traffic. EACH_QUORUM requires a quorum from every data center, which is stricter. ANY can acknowledge writes even before they're written to a replica, using a hinted handoff, which weakens consistency. SERIAL is used with lightweight transactions, not basic local consistency.
When using the ANY consistency level for a write, what is the minimum requirement for Cassandra to acknowledge success?
Explanation: ANY returns success as soon as the data is written to at least one node or even as a hint, regardless of its visibility to clients. Requiring visibility to all replicas describes ALL. Responses from all data centers are unrelated to ANY, and three replicas correspond to QUORUM or THREE, which are stricter.
Which consistency level typically has the lowest read latency in Cassandra?
Explanation: ONE has the lowest latency because it only waits for the fastest responding replica. TWO and QUORUM require coordination between more nodes, increasing response time. ALL, requiring every replica to reply, generates the highest latency.
You want to ensure maximum data consistency for both reads and writes; which consistency level should you use?
Explanation: ALL ensures that all replicas must participate for an operation to succeed, guaranteeing the highest consistency. TWO is less strict and may not include all replicas. LOCAL_ONE is fast but less consistent, and ZERO does not verify data propagation at all.
Which consistency level is required for conditional updates using lightweight transactions in Cassandra?
Explanation: SERIAL enforces consensus based on the Paxos algorithm for operations needing conditional updates or lightweight transactions. ONE and QUORUM are used for basic operations and do not provide linearizability. LOCAL_QUORUM improves local reliability but doesn't guarantee conditional update safety.
Which consistency level in Cassandra maximizes data availability at the expense of strict consistency?
Explanation: Consistency level ONE allows a read or write to succeed as long as one replica responds, boosting availability even if others are down. ALL sacrifices availability for consistency. QUORUM and EACH_QUORUM offer a balance but are not as available as ONE.
If you write with QUORUM and read with QUORUM, what does this guarantee regarding data consistency?
Explanation: Writing and reading at QUORUM ensures that at least one replica involved in the write also participates in the read, guaranteeing the latest data. Reading might miss a write only at lower levels. Writes failing with all nodes up is incorrect, and doubling replicas is unrelated to this feature.
Which phrase best describes Cassandra's approach to consistency levels?
Explanation: Cassandra allows clients to choose the consistency level for each operation, offering flexibility. Consistency is not cluster-wide or fixed. The system supports more than eventual consistency, thanks to several available consistency levels. Settings do not have to be decided during node startup—the choice happens per client request.