Cassandra MCQ

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?

a) Relational Database
b) Document-based NoSQL Database
c) Columnar NoSQL Database
d) Graph Database

Answer:

c) Columnar NoSQL Database

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?

a) SQL
b) NoSQL
c) CQL
d) DQL

Answer:

c) CQL

Explanation:

Cassandra Query Language (CQL) is a query language for the Cassandra database.

3. Which of the following best describes the architecture of Cassandra?

a) Master-Slave
b) Master-Master
c) Peer-to-Peer
d) Client-Server

Answer:

c) Peer-to-Peer

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?

a) Google
b) Amazon
c) Facebook
d) Microsoft

Answer:

c) Facebook

Explanation:

Cassandra was originally developed by Facebook to power their Inbox search feature.

5. In Cassandra, what does the term "compaction" refer to?

a) Combining multiple tables
b) Shrinking database size
c) Merging multiple SSTables into one
d) Distributing data uniformly across nodes

Answer:

c) Merging multiple SSTables into one

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?

a) Master node
b) Sharding
c) Replication
d) Compaction

Answer:

c) Replication

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?

a) QUORUM
b) ALL
c) ONE
d) TWO

Answer:

c) ONE

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?

a) B-Tree
b) AVL Tree
c) Memtable
d) Log Structured Merge Tree

Answer:

c) Memtable

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?

a) Super Storage Table
b) Sorted String Table
c) Sequential String Table
d) Sorted String Tree

Answer:

b) Sorted String Table

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?

a) Column
b) Table
c) Database
d) Row

Answer:

c) Database

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?

a) Disk
b) Memtable
c) SSTable
d) Commit Log

Answer:

d) Commit Log

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?

a) Column
b) Column family
c) Keyset
d) Super column

Answer:

c) Keyset

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?

a) 9041
b) 9042
c) 8080
d) 7000

Answer:

b) 9042

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"?

a) SELECT ALL FROM users;
b) GET * FROM users;
c) SELECT * FROM users;
d) READ * FROM users;

Answer:

c) SELECT * FROM users;

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

a) UNIQUEID
b) ID
c) STRING
d) UUID

Answer:

d) UUID

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?

a) MODIFY
b) CHANGE
c) ALTER
d) UPDATE

Answer:

d) UPDATE

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?

a) DELETE * FROM employees;
b) DROP ALL FROM employees;
c) TRUNCATE employees;
d) REMOVE * FROM employees;

Answer:

c) TRUNCATE employees;

Explanation:

The TRUNCATE command is used to delete all rows from a table while leaving the table structure intact.


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top