CASSANDRA MCQ 4 — Questions and Answers
Question 1: A Cassandra keyspace uses replication factor 3. What is the minimum number of replicas that must respond for a QUORUM read to succeed?
- 1
- 2 (Correct answer)
- 3
- 4
Correct answer: 2
QUORUM is calculated as floor(replication_factor / 2) + 1, so with RF=3, at least 2 replicas must respond.
Question 2: Which consistency level guarantees that a write is acknowledged only after it is persisted to all replicas, including those in remote datacenters?
- LOCAL_QUORUM
- QUORUM
- ALL (Correct answer)
- EACH_QUORUM
Correct answer: ALL
ALL requires every replica across all datacenters to acknowledge the write, giving the strongest consistency but lowest availability.
Question 3: What is hinted handoff in Apache Cassandra?
- A mechanism that stores missed writes for a temporarily unavailable node and delivers them when it recovers (Correct answer)
- The process of choosing which coordinator node handles a request
- A read-repair technique that synchronizes replicas after a read
- The strategy for assigning token ranges to new nodes
Correct answer: A mechanism that stores missed writes for a temporarily unavailable node and delivers them when it recovers
When a replica is down during a write, the coordinator stores a 'hint' and replays it to the target node once it comes back online, reducing the need for full repair.
Question 4: Which NetworkTopologyStrategy parameter controls how many replicas are placed per datacenter?
- replication_factor
- Per-datacenter replication_factor entries in the strategy options (Correct answer)
- consistency_level
- snitch_datacenter
Correct answer: Per-datacenter replication_factor entries in the strategy options
NetworkTopologyStrategy accepts a separate replication factor for each datacenter as named options (e.g., 'dc1': 3, 'dc2': 2).
Question 5: What does read repair do in Cassandra?
- Re-compacts SSTables after a node rejoins the cluster
- Fixes inconsistencies between replicas by synchronizing data during a read request (Correct answer)
- Rewrites tombstones to prevent zombie data
- Validates the Bloom filter index against disk SSTables
Correct answer: Fixes inconsistencies between replicas by synchronizing data during a read request
During a read, if the coordinator detects replica disagreement, it initiates a background (or foreground) repair to bring all replicas to the latest version.
Question 6: Which snitch type is recommended for multi-datacenter deployments in cloud environments such as AWS or GCP?
- SimpleSnitch
- GossipingPropertyFileSnitch (Correct answer)
- PropertyFileSnitch
- DynamicSnitch
Correct answer: GossipingPropertyFileSnitch
GossipingPropertyFileSnitch reads datacenter/rack information from cassandra-rackdc.properties and propagates it via gossip, making it the preferred choice for cloud and multi-DC setups.
Question 7: A write with consistency level LOCAL_ONE means Cassandra will wait for acknowledgment from:
- One replica across all datacenters
- One replica only in the local datacenter (Correct answer)
- One replica plus the coordinator node
- The closest replica determined by dynamic snitch
Correct answer: One replica only in the local datacenter
LOCAL_ONE requires acknowledgment from exactly one replica in the same datacenter as the coordinator, reducing cross-DC latency.
A Cassandra keyspace uses replication factor 3.
What is the minimum number of replicas that must respond for a QUORUM read to succeed?