Apache Cassandra is a highly scalable, distributed, and decentralized NoSQL database system. It is designed to handle vast amounts of data across multiple servers without any single point of failure. For those who are just beginning their journey into the world of NoSQL databases, we’ve curated a list of basic Cassandra multiple-choice questions to test your understanding. Dive in!
1. What type of database is Cassandra?
Answer:
Explanation:
Cassandra is a column-oriented NoSQL database, designed to manage large volumes of structured data across many servers.
2. Which language is used to query Cassandra?
Answer:
Explanation:
Cassandra Query Language (CQL) is a query language for the Cassandra database.
3. Which of the following best describes the architecture of Cassandra?
Answer:
Explanation:
Cassandra follows a peer-to-peer architecture where all nodes in the cluster are treated equally, avoiding single points of failure.
4. Which company originally developed Cassandra?
Answer:
Explanation:
Cassandra was originally developed by Facebook to power their Inbox search feature.
5. In Cassandra, what does the term "compaction" refer to?
Answer:
Explanation:
Compaction in Cassandra refers to the process of reclaiming space by merging SSTables and discarding duplicate data.
6. Which of the following ensures high availability in Cassandra?
Answer:
Explanation:
To ensure high availability, data is replicated across multiple nodes in a Cassandra cluster.
7. Which consistency level ensures the fastest write operations in Cassandra?
Answer:
Explanation:
With a consistency level of ONE, a write must be written to the commit log and memtable of at least one replica node.
8. Which data structure is used to store data in memory in Cassandra?
Answer:
Explanation:
In Cassandra, after data is written, it is first stored in a structure in memory called the memtable.
9. What does SSTable stand for in the context of Cassandra?
Answer:
Explanation:
In Cassandra, SSTable stands for Sorted String Table, which is an immutable data file to which Cassandra writes memtables periodically.
10. In Cassandra, a ‘Keyspace’ is equivalent to what in relational databases?
Answer:
Explanation:
In Cassandra, a 'Keyspace' is similar to a 'Database' in relational DBMS. It's a namespace to hold a set of tables.
11. What is the primary write destination in Cassandra?
Answer:
Explanation:
In Cassandra, the primary write destination is the commit log. Once the write has been committed to the log, it's then written to the memtable.
12. Which of the following is NOT a component of Cassandra's data model?
Answer:
Explanation:
Cassandra's data model comprises columns, column families, and super columns. "Keyset" is not a term associated with its data model.
13. What is the default port number on which Cassandra's CQL native transport listens?
Answer:
Explanation:
By default, Cassandra's CQL native transport listens on port 9042. This is the port that client libraries use to connect to the Cassandra cluster.
14. Which CQL query is used to retrieve all columns of all rows from a table named "users"?
Answer:
Explanation:
In Cassandra's CQL, the correct syntax to retrieve all columns of all rows from a table is SELECT * FROM <table_name>;.
15. In CQL, what is the correct data type to store a UUID (Universally Unique Identifier)?
Answer:
Explanation:
In CQL, the UUID data type is used to store universally unique identifiers.
16. Which CQL command is used to modify data in an existing row or rows of a table?
Answer:
Explanation:
The UPDATE command is used in CQL to modify data in an existing row or rows of a table.
17. To delete all rows from a table named "employees" without removing the table itself, which query should be used?
Answer:
Explanation:
The TRUNCATE command is used to delete all rows from a table while leaving the table structure intact.