Javatpoint Logo
Javatpoint Logo

Neo4J Interview Questions

A list of top frequently asked Neo4J interview questions and answers are given below.


1) What is Neo4J

Neo4J is an open-source, schema-free, NoSQL, popular graph database. It is the world's leading open-source graph database.


2) Why Neo4J is called graph database?

Neo4J is called graph database because it saves data structure in graph rather than in tables.


3) In which language Neo4G is written?

Neo4J is written and implemented in Java language.


4) Which query language is used by Neo4J?

Cypher Query Language (CQL) is used by Neo4J.


5) Which was the Neo4J first version and when was it released?

The first version of Neo4J was Neo4j 1.0 and it was released in Feb, 2010.


6) In which cases Neo4J is widely used?

Neo4J is widely used for ?

  • Highly connected data ? Social Network
  • Recommendation- ( e-commerce)
  • Path Finding
  • Data First Schema (bottom-up)
  • Schema Evolution
  • A*(Least Cost Path)

7) What is the difference between RDBMS and Graph Database?

RDBMS and Graph Database both use different approaches to store and retrieve data. The following table specifies the differences between them:

RDBMS Graph Database
Tables Graphs
Rows Nodes
Columns and Data Properties and its Values
Constraints Relationships
Joins Traversal

8) What is the role of building blocks like Nodes, Relationships, Properties and Labels in Neo4J?

Roles of building blocks:

  • Nodes: They are entities equivalent to rows in table.
  • Relationship: It connects entities and structure domain.
  • Properties: It contains meta-data and attributes.
  • Labels: It groups nodes by role.

9) Which are the several popular Graph Databases?

Neo4J is a very popular Graph Database. Other Graph Databases are Oracle NoSQL Database, OrientDB, HypherGraphDB, GraphBase, InfiniteGraph, AllegroGraph etc.


10) Explain some important characteristics of Neo4J?

Important characteristics of Neo4J:

  • Neo4J is written on the top of JVM.
  • It can do memory caching for graphs and provides compact storage, resulting in efficient scale-up.
  • It provides continuous time traversals for relationship in the graph both in breadth and depth due to double linking on the storage level between nodes and relationships.
  • Relationship in Neo4j is fast and makes it possible to materialize and use new relationships later on to "shortcut" and speed up the domain data when new requirement arises.

11) How files are stored in Neo4J?

Neo4J stores graph data in a number of different store files, and each store file contains the data for a specific part of the graph for example relationships, nodes, properties etc.


12) Whjat is the difference between Neo4J Graph Database and MySQL?

Difference between Neo4J and MySQL:

Neo4J MySQL
Neo4J contains vertices and edges. Each vertex or node represent a key value or attribute. In MySQL, attributes are appended in plain table format.
In Neo4J, it is possible to store dynamic content like images, videos, audio etc. In relational databases, such as MySQL, it is difficult to store videos, audios and images.
It provides the capability of deep search into the database without affecting the performance along with efficient timing. It takes longer time for database search and also inconvenient compared to Neo4J.
In Neo4j, two or more objects can be related by making relationship between them. It lacks relationship and very difficult to use them for connected graphs and data.

13) What is CQL? How can you run CQL commands in Neo4J?

CQL stands for Cypher Query Language. You have to use "$" prompt to run all CQL commands in Neo4j.


14) What are the several different types of object caches in Neo4J?

There are two different types of object caches in Neo4j:

Reference Caches: This object clause facilitates you to use as much as allocated JVM heap memory as it can hold nodes and relationships.

High-performance Caches: It is assigned a certain maximum amount of space on the JVM heap and will delete objects whenever it grows bigger than that.

Relationship and Nodes are added to the object cache as soon as they are accessed.


15) Which query language does Neo4J use and what it contains?

Neo4j uses Cypher query language, which is unique to Neo4j. If you want to traverse a graph, you have to know where you want to begin (Start), the rules that allow traversal (Match) and what data you are expecting back (Return). The basic query contains:

  • START n
  • MATCH n-[r]- m
  • RETURN r;

16) What can you delete databases in Neo4J?

If you want to delete/remove entire graph directory you can use command rm -rf data/*as such Neo4j is not storing anything outside that.


17) Is it possible to query Neo4j over the internet?

As such Neo4j got RESTful API, you can query over the web, or you can run it locally. It runs in the Heroku or Cloud.


18) What Neo4j CQL command is used for?

Neo4j CQL command can be used for the following reasons:

  • It is used to create nodes with and without properties.
  • It is used to create a relationship between nodes with properties.
  • It is used to create a relationship between nodes without properties.
  • It is used to make multiple or single labels to a Node or a Relationship.

19) What is MATCH command in Neo4J? Where is it used?

Syntax for MATCH command:

The MATCH command cannot be used alone to fetch data from the database otherwise it will show invalid syntax error.


20) Why is SET clause used for in Neo4J?

In Neo4J CQL, SET clause is used for following purposes:

  • Update or Add properties values.
  • Add new properties to existing Relationship or Node.

21) Is it easy to fragment a Neo4J graph across multiple servers?

It is very difficult to fragment a Neo4J graph across multiple servers.