Unit 6: Introduction to Apache Cassandra - Practice Quiz
1 Which command is commonly used after installing Cassandra to check the status of nodes in the cluster?
cqlsh create
cassandra build
nodetool status
sstable start
2 What is a key feature of Cassandra's peer-to-peer architecture?
3 What is the main purpose of the gossip protocol in Cassandra?
4
What does a replication factor of 3 mean in Cassandra?
5
What does the consistency level ONE require for a successful write?
6 Which structures are normally updated first during a Cassandra write?
7 What is a keyspace in Cassandra?
8 What does a primary key uniquely identify in a Cassandra table?
9 What is the main role of a partition key in Cassandra?
10 What do clustering columns control in Cassandra?
11 What is a wide row in Cassandra commonly understood to contain?
12 What is CQL primarily used for?
13 Which CQL data type is commonly used to store a character string?
boolean
text
timestamp
decimal
14 Which CQL statement creates a new table?
GENERATE TABLE
INSERT TABLE
BUILD TABLE
CREATE TABLE
15 Which CQL command adds a row to a Cassandra table?
APPEND ROW
INSERT INTO
ADD RECORD
CREATE VALUE
16
Which clause identifies the row to modify in a CQL UPDATE statement?
WHERE
ALLOW FILTERING
ORDER BY
GROUP BY
17 What does Cassandra initially create when data is deleted?
18 Which CQL statement retrieves rows from a table?
SELECT
TRUNCATE
INSERT
UPDATE
19 Which CQL phrase permits a query that may require server-side filtering?
ALLOW FILTERING
ENABLE SEARCHING
FILTER ROWS
APPLY FILTER
20 What is the main purpose of compaction in Cassandra?
21
After installing Cassandra on a single server, cqlsh reports Connection refused on port 9042. What should an administrator check first?
system.log for startup errors
22 A client sends a write request to a Cassandra node that is not a replica for the target partition. What does that node normally do?
23 A Cassandra cluster receives more traffic, so two nodes are added. Which behavior best reflects Cassandra's peer-to-peer architecture?
24 Node A has outdated information about whether Node C is reachable. How is this information normally corrected in Cassandra?
25
A keyspace has a replication factor of . A write uses consistency level QUORUM, and one replica is unavailable. What is the expected result if the other two replicas acknowledge the write?
QUORUM requires two replica acknowledgments
QUORUM requires all three replica acknowledgments
26 A write is acknowledged before its data appears in an SSTable. Which explanation is correct?
27 A requested partition may have values in a memtable and several SSTables. How does a replica produce the current result?
28
A production cluster has data centers named dc1 and dc2. It needs three replicas in dc1 and two in dc2. Which keyspace definition is appropriate?
CREATE KEYSPACE app WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3','dc2':'2'};
CREATE KEYSPACE app WITH replication = {'class':'NetworkTopologyStrategy','dc1':'2','dc2':'3'};
CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','replication_factor':'2'};
CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','dc1':'3','dc2':'2'};
29
A readings table is queried by device_id and day, followed by a time range on recorded_at. Which primary key best supports this access pattern?
PRIMARY KEY ((device_id, day), recorded_at)
PRIMARY KEY ((recorded_at, day), device_id)
PRIMARY KEY ((device_id, recorded_at), day)
PRIMARY KEY (device_id, day, recorded_at)
30
An orders table uses country as its partition key, but almost all orders come from two countries. What is the most likely problem?
31
A table has PRIMARY KEY ((sensor_id), recorded_at). Which clause stores rows within each sensor partition in descending timestamp order?
WITH PARTITION ORDER BY (recorded_at DESC)
WITH CLUSTERING ORDER BY (recorded_at DESC)
WITH CLUSTERING ORDER BY (sensor_id DESC)
WITH PRIMARY ORDER BY (recorded_at DESC)
32 A time-series table stores all events for a customer in one partition, causing some partitions to grow continuously. Which redesign is most appropriate?
33
A table has PRIMARY KEY ((store_id), sale_date, sale_id). Which query follows the primary-key order and efficiently retrieves sales for one store over a date range?
SELECT * FROM sales WHERE store_id=? AND sale_date>=? AND sale_date<=?;
SELECT * FROM sales WHERE sale_date>=? AND sale_date<=? ALLOW FILTERING;
SELECT * FROM sales WHERE sale_id=? AND sale_date>=? AND sale_date<=?;
SELECT * FROM sales WHERE store_id>? AND sale_id=? ALLOW FILTERING;
34 An application needs identifiers that are unique and also contain timestamp information so events can be ordered by generation time. Which CQL data type is most suitable?
bigint
uuid
timeuuid
timestamp
35
An application must retrieve a user directly by a unique email address without using an index or ALLOW FILTERING. Which table definition best supports the query?
CREATE TABLE users_by_email (email text, user_id uuid PRIMARY KEY, name text);
CREATE TABLE users_by_email (email text, user_id uuid, name text, PRIMARY KEY ((user_id), email));
CREATE TABLE users_by_email (email text PRIMARY KEY, user_id uuid, name text);
CREATE TABLE users_by_email (email text, user_id uuid, name text, PRIMARY KEY ((user_id, email)));
36
A row with primary key id=10 already contains name='Ana' and city='Pune'. What happens after INSERT INTO users (id, name) VALUES (10, 'Anita');?
Anita, while the existing city value remains unchanged
37
A table is defined with PRIMARY KEY ((account_id), item_id). Which statement correctly updates the quantity of one item?
UPDATE cart SET item_id=8 WHERE account_id=20 AND item_id=7;
UPDATE cart SET quantity=4 WHERE account_id=20;
UPDATE cart SET quantity=4 WHERE item_id=7 ALLOW FILTERING;
UPDATE cart SET quantity=4 WHERE account_id=20 AND item_id=7;
38 What normally happens internally when a non-key column is deleted from a Cassandra row?
39
A large production table is frequently queried by a low-cardinality status column, and each status may match millions of rows across the cluster. What is generally the most scalable design?
ALLOW FILTERING to every query that restricts the status column
ALL before filtering rows by status
40 An administrator starts a major compaction and observes a temporary increase in disk usage. What is the most likely explanation?
41
A new Cassandra node must join an existing production cluster that uses virtual nodes and NetworkTopologyStrategy. Which configuration is essential before starting the node for the first time?
42
A client sends a write at consistency level QUORUM to node N1, but N1 is not a replica for the target partition. What role does N1 perform?
43 Which failure scenario most directly demonstrates Cassandra's peer-to-peer design?
44 Node A receives gossip state for node B with an older generation but a larger heartbeat version than the state it already stores. Which state should A treat as newer?
45
A keyspace uses NetworkTopologyStrategy with replication factors east: 3 and west: 3. A coordinator in east performs a write. Which acknowledgement requirements are correct?
QUORUM requires 6 acknowledgements overall, while LOCAL_QUORUM requires 4 acknowledgements from either data center
QUORUM requires 4 acknowledgements overall, while LOCAL_QUORUM requires 3 acknowledgements from east
QUORUM requires 3 acknowledgements overall, while LOCAL_QUORUM requires 2 acknowledgements from east
QUORUM requires 4 acknowledgements overall, while LOCAL_QUORUM requires 2 acknowledgements from east
46 At a replica, which sequence correctly describes a normal Cassandra write before an acknowledgement is returned?
47 A partition has versions in a memtable and several SSTables, including a row tombstone newer than some stored cells. How is a read result produced?
48 An application must list a customer's orders for one month in descending creation time without joins or server-side filtering. Which modeling approach best follows Cassandra's query-first design?
49
Given PRIMARY KEY ((account_id, day), event_time, event_id), which interpretation is correct?
account_id, day, and event_time form the partition key; event_id is the only clustering column
account_id and day are clustering columns; event_time and event_id form the composite partition key
account_id and day form the composite partition key; event_time and event_id are ordered clustering columns
account_id is the partition key; day, event_time, and event_id are ordered clustering columns
50
For a table with PRIMARY KEY ((tenant_id, bucket), ts, event_id), which query can normally execute without ALLOW FILTERING?
WHERE bucket=? AND ts=? AND event_id=? ORDER BY tenant_id DESC
WHERE tenant_id=? AND bucket=? AND ts>=? AND ts<? ORDER BY ts DESC
WHERE tenant_id=? AND ts>=? AND ts<? ORDER BY event_id DESC
WHERE tenant_id=? AND bucket=? AND event_id=? ORDER BY ts DESC
51
A sensor writes 10,000 measurements per second indefinitely. Why is PRIMARY KEY (sensor_id, measured_at) usually inferior to PRIMARY KEY ((sensor_id, day), measured_at)?
52
A user-defined type address must be stored as values in a map keyed by timestamp, while allowing individual map entries to be updated. Which CQL type is appropriate?
frozen<map<timestamp, frozen<address>>>
map<frozen<timestamp>, address>
map<timestamp, frozen<address>>
list<frozen<address>>
53 Which CQL definitions correctly create a two-data-center keyspace and a table whose rows are partitioned by tenant and month?
CREATE KEYSPACE ks WITH replication={'class':'LocalStrategy','dc1':3,'dc2':2}; CREATE TABLE ks.events (tenant text, month date, ts timestamp, v text, PRIMARY KEY ((ts,month),tenant));
CREATE KEYSPACE ks WITH replication={'class':'NetworkTopologyStrategy','replication_factor':5}; CREATE TABLE ks.events (tenant text, month date, ts timestamp, v text, PRIMARY KEY (ts,(tenant,month)));
CREATE KEYSPACE ks WITH replication={'class':'NetworkTopologyStrategy','dc1':3,'dc2':2}; CREATE TABLE ks.events (tenant text, month date, ts timestamp, v text, PRIMARY KEY ((tenant,month),ts));
CREATE KEYSPACE ks WITH replication={'class':'SimpleStrategy','dc1':3,'dc2':2}; CREATE TABLE ks.events (tenant text, month date, ts timestamp, v text, PRIMARY KEY (tenant,month,ts));
54
A row already contains note='old'. CQL executes INSERT INTO t (id, value) VALUES (1, 'new') USING TIMESTAMP 5000 AND TTL 60. Which statement is correct?
value receives timestamp 5000 and a 60-second TTL, while the omitted note column remains unchanged
value and note receive timestamp 5000 and expire after 60 seconds because TTL applies to the row
note is immediately tombstoned because an INSERT replaces every non-key column in the existing row
value is rejected because Cassandra does not permit INSERT to upsert an existing primary key
55
An application executes UPDATE accounts SET balance=900, version=8 WHERE id=42 IF version=7. What distinguishes this operation from a normal update?
56 A cell was written with timestamp 100 and deleted with timestamp 200. Before the tombstone is purged, replicas receive writes for the same cell at timestamps 150 and 250. What is the visible result after reconciliation?
57
A table uses PRIMARY KEY ((sensor_id, day), ts) and CLUSTERING ORDER BY (ts DESC). A query reads ten sensor partitions for one day and needs at most three newest rows from each partition. Which clause expresses that requirement?
PER PARTITION LIMIT 3
GROUP BY sensor_id LIMIT 3
ORDER BY ts DESC LIMIT 30
LIMIT 3
58
A large table is partitioned by user_id, but an analyst repeatedly queries WHERE country=? AND status=? ALLOW FILTERING. Which assessment is most accurate?
ALLOW FILTERING materializes a permanent index after the first query, making later executions proportional only to returned rows
ALLOW FILTERING restricts execution to one replica per token range, guaranteeing constant work regardless of table size
ALLOW FILTERING changes country and status into clustering columns and preserves partition-local ordering automatically
ALLOW FILTERING permits potentially large scans; a query-specific table is usually more predictable than relying on filtering or a broad index
59
A replica has been offline longer than gc_grace_seconds, and healthy replicas may already have compacted away tombstones for data still present on that replica. What is the safest action before returning it to service?
nodetool cleanup so its stale rows are converted into tombstones
60 A time-series table receives mostly time-ordered writes, uses daily buckets, and expires data with a uniform TTL. Which compaction decision best fits the workload?
TimeWindowCompactionStrategy and minimize late writes that place old timestamps into newer SSTables
SizeTieredCompactionStrategy and force major compaction daily to isolate each expiration window
LeveledCompactionStrategy and disable TTL so every level contains an equal number of expired rows
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →