Unit 6: Introduction to Apache Cassandra - Practice Quiz

INT312 — Big Data Fundamentals 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which command is commonly used after installing Cassandra to check the status of nodes in the cluster?

Installation of Apache Cassandra Easy
A. sstable start
B. nodetool status
C. cqlsh create
D. cassandra build

2 What is a key feature of Cassandra's peer-to-peer architecture?

Peer-to-peer architecture Easy
A. Only one node stores data
B. All nodes have equal roles
C. Clients manage all replicas
D. One node is always the master

3 What is the main purpose of the gossip protocol in Cassandra?

Gossip protocol Easy
A. Creating secondary indexes
B. Compressing stored values
C. Writing CQL queries
D. Sharing node state information

4 What does a replication factor of 3 mean in Cassandra?

Replication and consistency levels Easy
A. Three columns in each row
B. Three queries per request
C. Three tables in each keyspace
D. Three copies of each partition

5 What does the consistency level ONE require for a successful write?

Replication and consistency levels Easy
A. A majority must acknowledge
B. One replica must acknowledge
C. All replicas must acknowledge
D. No replica must acknowledge

6 Which structures are normally updated first during a Cassandra write?

Read and write paths Easy
A. Keyspace and partitioner
B. Commit log and memtable
C. Bloom filter and cache
D. SSTable and index file

7 What is a keyspace in Cassandra?

Keyspace Easy
A. A container for tables
B. A node communication port
C. A single column value
D. A temporary query result

8 What does a primary key uniquely identify in a Cassandra table?

Primary key Easy
A. An SSTable on disk
B. A node within the cluster
C. A keyspace within Cassandra
D. A row within the table

9 What is the main role of a partition key in Cassandra?

Partition key Easy
A. Determining the data partition
B. Sorting every table globally
C. Selecting the consistency level
D. Naming the cluster nodes

10 What do clustering columns control in Cassandra?

Clustering columns Easy
A. User permissions for a table
B. Node addresses in a cluster
C. Row order inside a partition
D. Replica count for a keyspace

11 What is a wide row in Cassandra commonly understood to contain?

Wide rows Easy
A. Many clustered rows in one partition
B. Many replicas in one data center
C. Many indexes on one column
D. Many keyspaces on one node

12 What is CQL primarily used for?

CQL (Cassandra Query Language) Easy
A. Installing the Java runtime
B. Managing network hardware
C. Compiling Cassandra source code
D. Interacting with Cassandra data

13 Which CQL data type is commonly used to store a character string?

CQL data types Easy
A. timestamp
B. text
C. boolean
D. decimal

14 Which CQL statement creates a new table?

Creating keyspaces and tables Easy
A. INSERT TABLE
B. CREATE TABLE
C. BUILD TABLE
D. GENERATE TABLE

15 Which CQL command adds a row to a Cassandra table?

Insert operations Easy
A. INSERT INTO
B. APPEND ROW
C. ADD RECORD
D. CREATE VALUE

16 Which clause identifies the row to modify in a CQL UPDATE statement?

Update operations Easy
A. GROUP BY
B. WHERE
C. ALLOW FILTERING
D. ORDER BY

17 What does Cassandra initially create when data is deleted?

Delete operations Easy
A. A tombstone marker
B. A new partition key
C. A replica strategy
D. A secondary index

18 Which CQL statement retrieves rows from a table?

Select operations Easy
A. TRUNCATE
B. UPDATE
C. SELECT
D. INSERT

19 Which CQL phrase permits a query that may require server-side filtering?

Filtering Easy
A. ENABLE SEARCHING
B. FILTER ROWS
C. ALLOW FILTERING
D. APPLY FILTER

20 What is the main purpose of compaction in Cassandra?

Compaction Easy
A. Changing the partition key
B. Merging SSTables on disk
C. Increasing the replication factor
D. Creating keyspaces automatically

21 After installing Cassandra on a single server, cqlsh reports Connection refused on port 9042. What should an administrator check first?

Installation of Apache Cassandra Medium
A. Execute major compaction to initialize the native transport service
B. Run a full repair and wait for all token ranges to synchronize
C. Verify that Cassandra is running and inspect system.log for startup errors
D. Increase the replication factor of the system keyspaces to three

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?

Cassandra Architecture Medium
A. It asks a master node to choose a replica and process the request
B. It rejects the request because clients must contact a replica directly
C. It acts as coordinator and forwards the write to the appropriate replicas
D. It stores the partition locally and transfers it during the next repair

23 A Cassandra cluster receives more traffic, so two nodes are added. Which behavior best reflects Cassandra's peer-to-peer architecture?

Peer-to-peer architecture Medium
A. One new node becomes the master, and the other becomes its standby replica
B. Clients must permanently designate one of the new nodes as the cluster leader
C. Token ownership is redistributed, and relevant data is streamed to the new nodes
D. All writes pause until every existing SSTable is copied to both new nodes

24 Node A has outdated information about whether Node C is reachable. How is this information normally corrected in Cassandra?

Gossip protocol Medium
A. Clients publish node health information after every successful CQL operation
B. The seed nodes broadcast a complete cluster snapshot before every request
C. Compaction processes compare SSTable ownership and update the failure detector
D. Nodes periodically exchange endpoint state and generation information through gossip

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?

Replication and consistency levels Medium
A. The write succeeds because QUORUM requires two replica acknowledgments
B. The write fails because consistency levels cannot tolerate unavailable replicas
C. The write fails because QUORUM requires all three replica acknowledgments
D. The write succeeds after receiving an acknowledgment from only one replica

26 A write is acknowledged before its data appears in an SSTable. Which explanation is correct?

Read and write paths Medium
A. The write was placed in an SSTable index without storing its column values
B. The write was recorded in the commit log and memtable before acknowledgment
C. The write was stored only in a row cache until the next repair operation
D. The write was sent through gossip and will later enter the commit log

27 A requested partition may have values in a memtable and several SSTables. How does a replica produce the current result?

Read and write paths Medium
A. It waits for compaction to combine every version into one SSTable
B. It merges relevant versions and reconciles timestamps and tombstones
C. It returns the memtable version without examining persisted data
D. It reads only the newest SSTable and ignores all earlier structures

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?

Keyspace Medium
A. CREATE KEYSPACE app WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3','dc2':'2'};
B. CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','replication_factor':'2'};
C. CREATE KEYSPACE app WITH replication = {'class':'NetworkTopologyStrategy','dc1':'2','dc2':'3'};
D. 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 Medium
A. PRIMARY KEY ((device_id, day), recorded_at)
B. PRIMARY KEY ((recorded_at, day), device_id)
C. PRIMARY KEY (device_id, day, recorded_at)
D. PRIMARY KEY ((device_id, recorded_at), day)

30 An orders table uses country as its partition key, but almost all orders come from two countries. What is the most likely problem?

Partition key Medium
A. A few partitions and nodes will receive a disproportionate amount of traffic
B. Cassandra will reject inserts after each country has more than one order
C. Every order will be copied automatically to all nodes in the cluster
D. Clustering columns will be distributed independently across different nodes

31 A table has PRIMARY KEY ((sensor_id), recorded_at). Which clause stores rows within each sensor partition in descending timestamp order?

Clustering columns Medium
A. WITH PRIMARY ORDER BY (recorded_at DESC)
B. WITH CLUSTERING ORDER BY (sensor_id DESC)
C. WITH CLUSTERING ORDER BY (recorded_at DESC)
D. WITH PARTITION 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?

Wide rows Medium
A. Store every event attribute in a single unindexed text collection
B. Add a time bucket such as month to the composite partition key
C. Move the event timestamp from a clustering column to a regular column
D. Replace the customer identifier with a constant partition key value

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 operations Medium
A. SELECT * FROM sales WHERE sale_date>=? AND sale_date<=? ALLOW FILTERING;
B. SELECT * FROM sales WHERE store_id=? AND sale_date>=? AND sale_date<=?;
C. SELECT * FROM sales WHERE sale_id=? AND sale_date>=? AND sale_date<=?;
D. 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?

CQL data types Medium
A. timeuuid
B. bigint
C. uuid
D. 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?

Creating keyspaces and tables Medium
A. CREATE TABLE users_by_email (email text, user_id uuid PRIMARY KEY, name text);
B. CREATE TABLE users_by_email (email text, user_id uuid, name text, PRIMARY KEY ((user_id), email));
C. CREATE TABLE users_by_email (email text, user_id uuid, name text, PRIMARY KEY ((user_id, email)));
D. CREATE TABLE users_by_email (email text PRIMARY KEY, user_id uuid, name text);

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');?

Insert operations Medium
A. The entire row is replaced, and the city is automatically set to null
B. A second row with the same primary key is appended to the partition
C. The statement fails because Cassandra does not permit duplicate primary keys
D. The name becomes 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 operations Medium
A. UPDATE cart SET quantity=4 WHERE item_id=7 ALLOW FILTERING;
B. UPDATE cart SET quantity=4 WHERE account_id=20;
C. UPDATE cart SET quantity=4 WHERE account_id=20 AND item_id=7;
D. UPDATE cart SET item_id=8 WHERE account_id=20 AND item_id=7;

38 What normally happens internally when a non-key column is deleted from a Cassandra row?

Delete operations Medium
A. A tombstone is written and may be removed later during compaction
B. The column is removed only from memory and remains permanently visible
C. Every SSTable containing the row is immediately rewritten in place
D. The entire partition is transferred to another node before deletion

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?

Indexing Medium
A. Raise the consistency level to ALL before filtering rows by status
B. Add ALLOW FILTERING to every query that restricts the status column
C. Create a query-specific table partitioned by status and an additional bucket
D. Create one secondary index and scan all matching entries without bucketing

40 An administrator starts a major compaction and observes a temporary increase in disk usage. What is the most likely explanation?

Compaction Medium
A. New SSTables coexist with old SSTables until the compaction completes successfully
B. Compaction raises the keyspace replication factor while merging partition data
C. The commit log creates a permanent duplicate of every SSTable being compacted
D. Gossip temporarily stores complete replicas of all partitions on each node

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?

Installation of Apache Cassandra Hard
A. Use the existing cluster name, reachable seed addresses, a routable listen address, and the cluster's topology-compatible snitch
B. Use a unique cluster name, reuse an existing node's listen address, and configure the replication factor locally
C. Use a unique cluster name, make the new node its own seed, and copy token values from an existing node
D. Use the existing cluster name, configure every existing node as a seed, and disable virtual node allocation

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?

Cassandra Architecture Hard
A. It becomes the coordinator, forwards the mutation to replicas, and waits for the required acknowledgements
B. It stores the mutation locally, transfers token ownership, and acknowledges after the next compaction
C. It redirects the client to the primary replica and takes no further part in processing the mutation
D. It asks a seed node to select a leader, which serializes the mutation across all replicas

43 Which failure scenario most directly demonstrates Cassandra's peer-to-peer design?

Peer-to-peer architecture Hard
A. The transaction leader fails, so each partition must select a replacement before accepting requests
B. The elected primary fails, so all writes pause until a secondary primary completes election
C. A seed node fails after cluster formation, but other nodes continue coordinating reads and writes
D. The metadata master fails, so replicas continue reads but reject schema and data mutations

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?

Gossip protocol Hard
A. Neither state, because conflicting gossip states require synchronous agreement from a seed node
B. The received state, because heartbeat versions always take precedence over generation numbers
C. The received state, because the numerically largest field determines the newest endpoint state
D. The stored state, because a newer generation takes precedence over heartbeat versions from older generations

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?

Replication and consistency levels Hard
A. QUORUM requires 3 acknowledgements overall, while LOCAL_QUORUM requires 2 acknowledgements from east
B. QUORUM requires 4 acknowledgements overall, while LOCAL_QUORUM requires 2 acknowledgements from east
C. QUORUM requires 4 acknowledgements overall, while LOCAL_QUORUM requires 3 acknowledgements from east
D. QUORUM requires 6 acknowledgements overall, while LOCAL_QUORUM requires 4 acknowledgements from either data center

46 At a replica, which sequence correctly describes a normal Cassandra write before an acknowledgement is returned?

Read and write paths Hard
A. Update an SSTable in place, append to the commit log, acknowledge, and later rebuild the memtable
B. Flush a new SSTable, update the row cache, acknowledge, and later append to the commit log
C. Append to the commit log, update the memtable, acknowledge, and later flush an immutable SSTable
D. Update the memtable, compact all overlapping SSTables, acknowledge, and later persist a commit-log entry

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?

Read and write paths Hard
A. All SSTables are scanned sequentially, and the value from the physically last SSTable is returned
B. The memtable is ignored after the first flush, and compaction supplies the only authoritative row version
C. Only the newest SSTable is read, and its row replaces all versions in older storage structures
D. Relevant sources are merged by timestamps, and the tombstone suppresses cells with older timestamps

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?

Cassandra Data Model Hard
A. Create an orders-by-customer-month table partitioned by customer and month, with creation time as a clustering column
B. Create one normalized orders table partitioned by order ID, then join it to customers during each CQL query
C. Create one cluster-wide monthly partition, index customer ID, and sort the filtered results at the coordinator
D. Create a customer table containing an unbounded frozen list of every order and rewrite the list per purchase

49 Given PRIMARY KEY ((account_id, day), event_time, event_id), which interpretation is correct?

Primary key Hard
A. account_id is the partition key; day, event_time, and event_id are ordered clustering columns
B. account_id, day, and event_time form the partition key; event_id is the only clustering column
C. account_id and day are clustering columns; event_time and event_id form the composite partition key
D. account_id and day form the composite partition key; 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?

Clustering columns Hard
A. WHERE bucket=? AND ts=? AND event_id=? ORDER BY tenant_id DESC
B. WHERE tenant_id=? AND ts>=? AND ts<? ORDER BY event_id DESC
C. WHERE tenant_id=? AND bucket=? AND event_id=? ORDER BY ts DESC
D. WHERE tenant_id=? AND bucket=? AND ts>=? AND ts<? 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)?

Wide rows Hard
A. The unbucketed design requires counters, while daily buckets convert each measurement into an idempotent static row
B. The unbucketed design prevents timestamp ordering, while daily buckets automatically create a global timestamp index
C. The unbucketed design disables replication, while daily buckets independently replicate every clustering column
D. The unbucketed design creates an ever-growing partition, while daily buckets bound partition size at the cost of multi-day fan-out

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?

CQL data types Hard
A. list<frozen<address>>
B. map<frozen<timestamp>, address>
C. map<timestamp, frozen<address>>
D. frozen<map<timestamp, frozen<address>>>

53 Which CQL definitions correctly create a two-data-center keyspace and a table whose rows are partitioned by tenant and month?

Creating keyspaces and tables Hard
A. 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));
B. 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)));
C. 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));
D. 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));

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?

Insert operations Hard
A. note is immediately tombstoned because an INSERT replaces every non-key column in the existing row
B. value receives timestamp 5000 and a 60-second TTL, while the omitted note column remains unchanged
C. value and note receive timestamp 5000 and expire after 60 seconds because TTL applies to the row
D. 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?

Update operations Hard
A. It is a lightweight transaction using consensus to apply the mutation only if the condition is current
B. It is a counter update that atomically modifies all replicas without requiring a consistency level
C. It is a logged batch that isolates every account partition until all replicas complete compaction
D. It is an asynchronous compare operation that may apply even when the returned condition is false

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?

Delete operations Hard
A. The timestamp-250 value is visible, while the timestamp-150 value remains shadowed by the tombstone
B. The physically latest arriving value is visible regardless of its client-supplied write timestamp
C. The timestamp-150 value is visible, while the timestamp-250 value is discarded as a conflicting update
D. Both values remain deleted because a tombstone permanently prevents reuse of the same primary key

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?

Select operations Hard
A. ORDER BY ts DESC LIMIT 30
B. PER PARTITION LIMIT 3
C. GROUP BY sensor_id LIMIT 3
D. 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?

Filtering Hard
A. ALLOW FILTERING materializes a permanent index after the first query, making later executions proportional only to returned rows
B. ALLOW FILTERING permits potentially large scans; a query-specific table is usually more predictable than relying on filtering or a broad index
C. ALLOW FILTERING restricts execution to one replica per token range, guaranteeing constant work regardless of table size
D. ALLOW FILTERING changes country and status into clustering columns and preserves partition-local ordering automatically

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?

Cassandra Administration Hard
A. Run major compaction on the stale node so its old values receive the newest cluster timestamps
B. Add it as a seed and increase read consistency so gossip automatically deletes its stale rows
C. Remove its stale data and replace or rebuild the node from current replicas before serving requests
D. Start it normally and run 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?

Compaction Hard
A. Use LeveledCompactionStrategy and disable TTL so every level contains an equal number of expired rows
B. Use SizeTieredCompactionStrategy and force major compaction daily to isolate each expiration window
C. Disable compaction and rely on read repair to remove fully expired SSTables from every replica
D. Use TimeWindowCompactionStrategy and minimize late writes that place old timestamps into newer SSTables