CASSANDRA MCQ 2 — Questions and Answers
Question 1: Which internal Cassandra component stores recently written data in memory before flushing to disk?
- SSTable
- Memtable (Correct answer)
- Commit log
- Bloom filter
Correct answer: Memtable
The memtable is an in-memory structure that accumulates writes until it reaches a threshold and is flushed to an SSTable on disk.
Question 2: What is the purpose of the Bloom filter in Apache Cassandra?
- Compress SSTables on disk
- Determine partition token ranges
- Quickly check if a partition key exists in an SSTable (Correct answer)
- Coordinate gossip between nodes
Correct answer: Quickly check if a partition key exists in an SSTable
Bloom filters are probabilistic data structures that allow Cassandra to skip reading SSTables that definitely do not contain a requested partition key.
Question 3: Which Cassandra compaction strategy is best suited for time-series data with predictable expiration via TTL?
- SizeTieredCompactionStrategy (STCS)
- LeveledCompactionStrategy (LCS)
- TimeWindowCompactionStrategy (TWCS) (Correct answer)
- DateTieredCompactionStrategy (DTCS)
Correct answer: TimeWindowCompactionStrategy (TWCS)
TWCS groups SSTables into time windows so that entire windows can be dropped when their TTL expires, making it ideal for time-series workloads.
Question 4: What does the Cassandra gossip protocol accomplish?
- Replicate data between datacenters
- Distribute tokens evenly across the ring
- Exchange state information about nodes across the cluster (Correct answer)
- Coordinate lightweight transactions
Correct answer: Exchange state information about nodes across the cluster
Gossip is a peer-to-peer communication protocol where nodes periodically exchange metadata (status, load, schema version) with a few peers to propagate cluster state.
Question 5: In Cassandra's write path, which file provides durability by recording every mutation before it is acknowledged?
- SSTable
- Memtable
- Hint file
- Commit log (Correct answer)
Correct answer: Commit log
The commit log is a sequential append-only file written before the memtable, ensuring data is not lost if the node crashes before the memtable is flushed.
Question 6: What are virtual nodes (vnodes) in Apache Cassandra?
- Logical containers for materialised views
- Multiple smaller token ranges assigned to each node instead of one large range (Correct answer)
- Dedicated nodes that handle only read traffic
- Separate JVM instances on a single machine
Correct answer: Multiple smaller token ranges assigned to each node instead of one large range
Vnodes allow each physical node to own many small, non-contiguous token ranges, improving load distribution and simplifying cluster scaling.
Question 7: Which nodetool command triggers a full repair to synchronize data across all replicas for a keyspace?
- nodetool sync
- nodetool cleanup
- nodetool repair (Correct answer)
- nodetool compaction
Correct answer: nodetool repair
`nodetool repair` performs anti-entropy repair, comparing Merkle trees across replicas and streaming any missing or divergent data.
Which internal Cassandra component stores recently written data in memory before flushing to disk?