15 Best SQL Queries for Developers [SQL Queries]

38 Best Cassandra Interview Questions and Answers [Q/A]

What is Cassandra?
Answers: - The Cassandra is a free open source data storage system. It is developed by “Facebook”. It is used for “inbox search” and designed for storing and managing huge amounts of data.

The Cassandra is a NOSQL database which has high scalability and availability.

It is highly scalable, high-performance distributed database system and used for “Real Time” data store system for online and it is no single point of failure.

The Cassandra is a right choice when we need scalability and high availability without compromising performance.

Cassandra is written in which language?
Answers: -The Cassandra had written using “Java” language.

JMX stands for?
Answers: - The “JMX” stands for “Java Management Extension”.

“What is” Cassandra vs. Mongodb?

What is the advantage of Cassandra?
Answers: - The main advantage as following as,
1.      It’s is a free Open Source.
2.      It’s supported User Defined types.
3.      The idea is based on wide column store of BigTable and DynamoDB.
4.      Its extensible record stores and also store data in records with an ability to hold very large numbers of dynamic columns.
5.      It’s Implementation using Java language.
6.      It’s using Server operating systems like BSD, Linux, OS X, and Windows.
7.      Its schema free and secondary indexes restricted.
8.      The APIs and other methods access by proprietary protocols.
9.      It’s used sharding methods for partitioning.

When should you use Cassandra?
Answers: - The Cassandra is a NoSQL database and does not provide ACID and relational data property and its high scalability and availability and also no single point of failure.

How many types of NoSQL databases?
Answers: - Right now, 4 Types of NoSQL databases as,
1.      Document Stores (MongoDB, Couchbase)
2.      Column Stores (Cassandra)
3.      Key Value Stores (Redis, Volgemort)
4.      Graph Stores (Neo4j, Giraph)

What do you understand by Commit log in Cassandra?
Answers: - In Cassandra, commit log is a crash recovery mechanism. Each and every write operations are written to the commit log.

Define composite type in Cassandra?
Answers: - Composite type allows us to defining a key or a column name with a concatenation of data of different type in Cassandra.
Here are 2 types of Composite Types as,
1.      Row Key
2.      Column Name

How Cassandra stores data?
Answers: - In Cassandra, all the data stored as bytes. When you specify validators, Cassandra ensures those bytes are encoded or not as per your requirement.
This comparator orders the column based on the ordering specific to the encoding, while composite are just byte arrays with a specific encoding and for each components it stores a two byte length followed by the byte encoded components followed by a termination bit.

What is SSTable?
Answers: - The SStable consist two files that are,
1.      Index file.
2.      Data file.

What do you understand by Node in Cassandra?
Answers: - In Cassandra, the “Node” is the place where data is stored.

What is bloom filter?
Answers: - The Bloom filter is an off heap data structure and is used to check to data availability in the SSTable before performing any “I/O disk” operations.

What is Thrift?
Answers: - The Thrift is the name of the Remote Procedure Call (RPC) client and it used to communicate with the Cassandra server.

What are the main components of Cassandra Data Model?
Answers: - The Cassandra Data Model consists of 4 major components as following as,
1.      Cluster: - These are made-up of multiple nodes and keyspaces.
2.      Keyspace: - It’s a namespace and used to group multiple column families, especially one per partition.
3.      Column: - It’s consists of a column name, value and timestamp also.
4.      Column family: - It’s is used to refer to multiple columns with row key reference.

What is a column family in Cassandra?
Answers: - The Column family in Cassandra is referred for a collection of rows.

What is a cluster in Cassandra?
Answers: - “A Cluster is a container that contains one or more data centres.”
A “Cluster” is a container for the key-spaces and the “Cassandra” database is segmented over multiple machines that are work together.
It is also “Outermost container” which arranges the nodes in a ring format and assigns data to them and these nodes have a replica which used to handling the data in case of failure.

List out the other components of Cassandra?
Answers: - The COLLECTIONS list of the other components is,
1.      Cluster
2.      Node
3.      SSTable
4.      Mem-table
5.      Data Centre
6.      Commit log
7.      Bloom Filter
8.      And so on..

What do you understand by Cluster in Cassandra?
Answers: - “A Cluster is a container that contains one or more data centres.”
A “Cluster” is a container for the key-spaces and the “Cassandra” database is segmented over multiple machines that are work together.

What do you mean by “Data Centre” in Cassandra?
Answers: - The Cassandra “Data centre” is a collection of nodes and these nodes have a replica which used to handling the data in case of failure.

What is a keyspace in Cassandra?
Answers: - A Cassandra keyspace is a namespace which used to determine the data replication on nodes and the “cluster” lies of one keyspace per node.

What is the syntax to create keyspace in Cassandra?
Answers: - The keyspace is a namespace which used to determine the data replication on nodes.

Syntax: -  CREATE KEYSPACE <identifier> WITH <properties>

What are the values stored in the Cassandra Column?
Answers: - In Cassandra, basically used 3(three) values that is
1.      Column Name
2.      Value
3.      Time Stamp

When you can use Alter keyspace?
Answers: - The “ALTER KEYSPACE” is used to change the properties like “number of replicas” and “durable write” of a keyspace.

What is Cassandra Cqlsh?
Answers: - The “Cassandra Cqlsh” is a query language which used to enables the users to communicate with database.

For this, we can do following things that is
1.      Define a Schema
2.      Insert a Data and
3.      Execute a Query

What is mandatory while creating a table in Cassandra?
Answers: - In the Cassandra database, the “primary key” is mandatory key while we creating a table and we can create one or more columns of a table.

What we need to be taken care while adding a Column?
Answers: - In the Cassandra database, while adding a new column you must need and follow the below points,
1.      The “Column name” is not conflicting with an “existing column” names and
2.      The “Table” is not defined with compact storage option.

Elaborate on Cassandra - CQL?
Answers: - In Cassandra database, the “CQL” collections are helping us to store multiple values in a single variable.

The CQL collections are
1)     List: - It’s used for maintained the data order and stored values multiple times.
2)     SET: - It’s used for store and returned to sorted orders.
3)     MAP: - It’s a data type and used to store a key value pair of elements.

How Cassandra writes data?
Answers: - The Cassandra writes the data in 3 components that is,
1.      Commit-log Write
2.      Memtable Write
3.      SStable Write

What is Memtable in Cassandra?
Answers: - The “Cassandra” writes the data to in-memory structure that is known as Memtable.

1.      It is an in-memory cache with the content stored as the key column.
2.      By the “key”, Memtable data are sorted.
3.      Each and every column contains a separates Memtable and also is used to retrieves column data from the key.

How Cassandra writes changed data into Commit-log?
Answers: - The following ways as,
1.      The Cassandra concatenates (write operations) changed data to commit-log.
2.      The commit-log acts as a “crash recovery log” for the data.
3.      The “commit-log” writes operation will be never considered successful.

What is the use of “void close ()” method?
Answers: - This “void close()” method is used to close the current instance of the session.

What is the Replication Factor?
Answers: - The “Replication Factor” is a unit of the “number of existing data copies”. It’s an essential to increase the replication factor to log into cluster.

What is the use of “ResultSet execute” method?
Answers: - This “ResultSet execute()”method is used to execute a query and It requires a statement object also.

How Cassandra delete Data?
Answers: - The “SSTables” are immutable. So we can’t remove a row from SSTables.

When a row needs to be deleted, the “Cassandra” assigns the column value with a special value called “Tombstone” and when the data is read, “Tombstone” value is considered as “deleted”.

So we can say that cannot delete data from the Cassandra database.

Stayed Informed - Apache Cassandra vs. Mongodb

I hope you are enjoying with this post! Please share with you friends. Thank you!!

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.