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. cqlsh create
B. cassandra build
C. nodetool status
D. sstable start

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. Clients manage all replicas
C. One node is always the master
D. All nodes have equal roles

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

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

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

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

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

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

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

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

7 What is a keyspace in Cassandra?

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

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

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

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

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

10 What do clustering columns control in Cassandra?

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

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

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

12 What is CQL primarily used for?

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

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

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

14 Which CQL statement creates a new table?

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

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

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

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

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

17 What does Cassandra initially create when data is deleted?

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

18 Which CQL statement retrieves rows from a table?

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

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

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

20 What is the main purpose of compaction in Cassandra?

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

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. Increase the replication factor of the system keyspaces to three
D. Verify that Cassandra is running and inspect 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?

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

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. All writes pause until every existing SSTable is copied to both new nodes
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. One new node becomes the master, and the other becomes its standby replica

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

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

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 succeeds after receiving an acknowledgment from only one replica
C. The write fails because consistency levels cannot tolerate unavailable replicas
D. The write fails because QUORUM requires all three replica acknowledgments

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 recorded in the commit log and memtable before acknowledgment
B. The write was placed in an SSTable index without storing its column values
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 returns the memtable version without examining persisted data
B. It waits for compaction to combine every version into one SSTable
C. It reads only the newest SSTable and ignores all earlier structures
D. It merges relevant versions and reconciles timestamps and tombstones

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':'NetworkTopologyStrategy','dc1':'2','dc2':'3'};
C. CREATE KEYSPACE app WITH replication = {'class':'SimpleStrategy','replication_factor':'2'};
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, recorded_at), day)
D. 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?

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

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

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

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 store_id=? AND sale_date>=? AND sale_date<=?;
B. SELECT * FROM sales WHERE sale_date>=? AND sale_date<=? ALLOW FILTERING;
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. bigint
B. uuid
C. timeuuid
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 PRIMARY KEY, user_id uuid, name text);
D. 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');?

Insert operations Medium
A. The statement fails because Cassandra does not permit duplicate primary keys
B. The entire row is replaced, and the city is automatically set to null
C. The name becomes Anita, while the existing city value remains unchanged
D. A second row with the same primary key is appended to the partition

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 item_id=8 WHERE account_id=20 AND item_id=7;
B. UPDATE cart SET quantity=4 WHERE account_id=20;
C. UPDATE cart SET quantity=4 WHERE item_id=7 ALLOW FILTERING;
D. 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?

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

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. Create one secondary index and scan all matching entries without bucketing
B. Create a query-specific table partitioned by status and an additional bucket
C. Add ALLOW FILTERING to every query that restricts the status column
D. Raise the consistency level to 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?

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

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 a unique cluster name, make the new node its own seed, and copy token values from an existing node
B. Use a unique cluster name, reuse an existing node's listen address, and configure the replication factor locally
C. Use the existing cluster name, reachable seed addresses, a routable listen address, and the cluster's topology-compatible snitch
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 asks a seed node to select a leader, which serializes the mutation across all replicas
B. It becomes the coordinator, forwards the mutation to replicas, and waits for the required acknowledgements
C. It redirects the client to the primary replica and takes no further part in processing the mutation
D. It stores the mutation locally, transfers token ownership, and acknowledges after the next compaction

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

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

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. The received state, because the numerically largest field determines the newest endpoint state
B. The stored state, because a newer generation takes precedence over heartbeat versions from older generations
C. Neither state, because conflicting gossip states require synchronous agreement from a seed node
D. The received state, because heartbeat versions always take precedence over generation numbers

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 6 acknowledgements overall, while LOCAL_QUORUM requires 4 acknowledgements from either data center
B. QUORUM requires 4 acknowledgements overall, while LOCAL_QUORUM requires 3 acknowledgements from east
C. QUORUM requires 3 acknowledgements overall, while LOCAL_QUORUM requires 2 acknowledgements from east
D. 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?

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

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. Relevant sources are merged by timestamps, and the tombstone suppresses cells with older timestamps
B. Only the newest SSTable is read, and its row replaces all versions in older storage structures
C. All SSTables are scanned sequentially, and the value from the physically last SSTable is returned
D. The memtable is ignored after the first flush, and compaction supplies the only authoritative row version

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 a customer table containing an unbounded frozen list of every order and rewrite the list per purchase
D. Create one cluster-wide monthly partition, index customer ID, and sort the filtered results at the coordinator

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

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

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

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

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. frozen<map<timestamp, frozen<address>>>
B. map<frozen<timestamp>, address>
C. map<timestamp, frozen<address>>
D. 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?

Creating keyspaces and tables Hard
A. 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));
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':'NetworkTopologyStrategy','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':'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?

Insert operations Hard
A. value receives timestamp 5000 and a 60-second TTL, while the omitted note column remains unchanged
B. value and note receive timestamp 5000 and expire after 60 seconds because TTL applies to the row
C. note is immediately tombstoned because an INSERT replaces every non-key column in the existing 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 logged batch that isolates every account partition until all replicas complete compaction
B. It is an asynchronous compare operation that may apply even when the returned condition is false
C. It is a lightweight transaction using consensus to apply the mutation only if the condition is current
D. It is a counter update that atomically modifies all replicas without requiring a consistency level

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

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. PER PARTITION LIMIT 3
B. GROUP BY sensor_id LIMIT 3
C. ORDER BY ts DESC LIMIT 30
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 restricts execution to one replica per token range, guaranteeing constant work regardless of table size
C. ALLOW FILTERING changes country and status into clustering columns and preserves partition-local ordering automatically
D. 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?

Cassandra Administration Hard
A. Remove its stale data and replace or rebuild the node from current replicas before serving requests
B. Run major compaction on the stale node so its old values receive the newest cluster timestamps
C. Start it normally and run nodetool cleanup so its stale rows are converted into tombstones
D. Add it as a seed and increase read consistency so gossip automatically deletes its stale rows

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