Skip to main content

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!!
By Anil Singh | Rating of this article (*****)

Popular posts from this blog

nullinjectorerror no provider for httpclient angular 17

In Angular 17 where the standalone true option is set by default, the app.config.ts file is generated in src/app/ and provideHttpClient(). We can be added to the list of providers in app.config.ts Step 1:   To provide HttpClient in a standalone app we could do this in the app.config.ts file, app.config.ts: import { ApplicationConfig } from '@angular/core'; import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; import { provideClientHydration } from '@angular/platform-browser'; //This (provideHttpClient) will help us to resolve the issue  import {provideHttpClient} from '@angular/common/http'; export const appConfig: ApplicationConfig = {   providers: [ provideRouter(routes),  provideClientHydration(), provideHttpClient ()      ] }; The appConfig const is used in the main.ts file, see the code, main.ts : import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from ...

List of Countries, Nationalities and their Code In Excel File

Download JSON file for this List - Click on JSON file    Countries List, Nationalities and Code Excel ID Country Country Code Nationality Person 1 UNITED KINGDOM GB British a Briton 2 ARGENTINA AR Argentinian an Argentinian 3 AUSTRALIA AU Australian an Australian 4 BAHAMAS BS Bahamian a Bahamian 5 BELGIUM BE Belgian a Belgian 6 BRAZIL BR Brazilian a Brazilian 7 CANADA CA Canadian a Canadian 8 CHINA CN Chinese a Chinese 9 COLOMBIA CO Colombian a Colombian 10 CUBA CU Cuban a Cuban 11 DOMINICAN REPUBLIC DO Dominican a Dominican 12 ECUADOR EC Ecuadorean an Ecuadorean 13 EL SALVA...

39 Best Object Oriented JavaScript Interview Questions and Answers

Most Popular 37 Key Questions for JavaScript Interviews. What is Object in JavaScript? What is the Prototype object in JavaScript and how it is used? What is "this"? What is its value? Explain why "self" is needed instead of "this". What is a Closure and why are they so useful to us? Explain how to write class methods vs. instance methods. Can you explain the difference between == and ===? Can you explain the difference between call and apply? Explain why Asynchronous code is important in JavaScript? Can you please tell me a story about JavaScript performance problems? Tell me your JavaScript Naming Convention? How do you define a class and its constructor? What is Hoisted in JavaScript? What is function overloadin...

25 Best Vue.js 2 Interview Questions and Answers

What Is Vue.js? The Vue.js is a progressive JavaScript framework and used to building the interactive user interfaces and also it’s focused on the view layer only (front end). The Vue.js is easy to integrate with other libraries and others existing projects. Vue.js is very popular for Single Page Applications developments. The Vue.js is lighter, smaller in size and so faster. It also supports the MVVM ( Model-View-ViewModel ) pattern. The Vue.js is supporting to multiple Components and libraries like - ü   Tables and data grids ü   Notifications ü   Loader ü   Calendar ü   Display time, date and age ü   Progress Bar ü   Tooltip ü   Overlay ü   Icons ü   Menu ü   Charts ü   Map ü   Pdf viewer ü   And so on The Vue.js was developed by “ Evan You ”, an Ex Google software engineer. The latest version is Vue.js 2. The Vue.js 2 is very similar to Angular because Evan ...

React | Encryption and Decryption Data/Text using CryptoJs

To encrypt and decrypt data, simply use encrypt () and decrypt () function from an instance of crypto-js. Node.js (Install) Requirements: 1.       Node.js 2.       npm (Node.js package manager) 3.       npm install crypto-js npm   install   crypto - js Usage - Step 1 - Import var   CryptoJS  =  require ( "crypto-js" ); Step 2 - Encrypt    // Encrypt    var   ciphertext  =  CryptoJS . AES . encrypt ( JSON . stringify ( data ),  'my-secret-key@123' ). toString (); Step 3 -Decrypt    // Decrypt    var   bytes  =  CryptoJS . AES . decrypt ( ciphertext ,  'my-secret-key@123' );    var   decryptedData  =  JSON . parse ( bytes . toString ( CryptoJS . enc . Utf8 )); As an Example,   import   React   from ...