Neo4j Q&A

[vc_row][vc_column css_animation=”fadeInLeft”][vc_column_text css=”.vc_custom_1562917782680{background-color: #1e73be !important;}”]

            Neo4j Interview Questions & Answers

[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column css_animation=”fadeInLeft” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=” Explain what is Neo4j?” tab_id=”1562917823054-f9dd70c7-4350″][vc_column_text]Neo4j is an open source NOSQL graph database, implemented in Java. It saves data structured in graphs rather than in tables.[/vc_column_text][/vc_tta_section][vc_tta_section title=”For what Neo4j is widely used for?” tab_id=”1562917823069-7b66c2a0-e868″][vc_column_text]Neo4j is widely used for

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

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention what is the difference between Neo4j graph database and MySQL?” tab_id=”1562917833939-a8fd79d7-15ba”][vc_column_text]

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

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention some of the important characteristics of neo4j?” tab_id=”1562917834490-54ff87bb-4c2f”][vc_column_text]Some important characteristics of neo4j includes

  • Materializing of relationship at creation time, resulting in no penalties for runtime queries
  • 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 make it possible to materialize and use new relationships later on to “shortcut” and speed up the domain data when new requirement arise
  • It can do memory caching for graphs and provides compact storage, resulting in efficient scale-up
  • It is written on the top of JVM

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain the role of building blocks like Nodes, Relationships, Properties and Labels in Neo4j?” tab_id=”1562917835022-059bdb6a-6ea6″][vc_column_text]The role of building blocks

  • Nodes: They are entities
  • Relationship: It connects entities and structure domain
  • Properties: It consists of meta-data and attributes
  • Labels: It group nodes by role

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain how you can run CQL commands in Neo4j?” tab_id=”1562917835734-5c620ba8-19df”][vc_column_text]You use “$” prompt to run all CQL commands in Neo4j.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention what are the different types of object caches in Neo4j?” tab_id=”1562917836704-c786554c-41c1″][vc_column_text]There are two different types of object caches in Neo4j

  • Reference Caches: With this cache, Neo4j will use as much as allocated JVM heap memory as it can hold nodes and relationships
  • High-performance Caches: It get 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[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention which query language does Neo4j use and what is consist of?” tab_id=”1562917837218-628de05b-381f”][vc_column_text]Neo4j uses Cypher query language, which is unique to Neo4j. Traversing the graph requires 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 consists of

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

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Is it possible that with Neo4j you can query it over the internet?” tab_id=”1562917837755-38463a9c-25b2″][vc_column_text]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.[/vc_column_text][/vc_tta_section][vc_tta_section title=” Explain how you can create/delete databases in Neo4j?” tab_id=”1562917838311-273cabcd-a242″][vc_column_text]To delete/remove entire graph directory you can use command rm –rf data/* as such Neo4j is not storing anything outside that.[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][vc_column css_animation=”fadeInRight” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”Explain how Neo4j can be helpful in detecting Brute Force Attack?” tab_id=”1562917842390-0eabe8d9-a310″][vc_column_text]Neo4J allows to store and retrieve multiple complex relations. The capability of Neo4j to do complex query in real time is really helpful in identifying a brute force attack much quicker.  The most crucial thing in detecting such attacks is to capture enough information about each requests like

  • Client real IP address and not the proxy one
  • Login failure or attempt success information
  • Timestamp

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention how indexing is done in Neo4j?” tab_id=”1562917842403-fff3c3a8-0a9d”][vc_column_text]There was no indexing in earlier days for Neo4j, but later on it was introduced with new feature Automatic Indexes by using the command[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention how files are stored in Neo4j?” tab_id=”1562917854208-68ac48b4-918b”][vc_column_text]Neo4j stores graph data in a number of different store files, and each store file consists of the data for a specific part of the graph for example relationships, nodes, properties etc. for example Neostore.nodestore.db, neostore.propertystore.db and so on.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention what Neo4j CQL command is used for?” tab_id=”1562917854769-0bad9d20-54df”][vc_column_text]Neo4j CQL command can be used for

  • To create nodes with and without properties
  • To create a relationship between nodes with properties
  • To create a relationship between nodes without properties
  • To make multiple or single labels to a Node or a Relationship

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain what Neo4j CQL MATCH command is used for?” tab_id=”1562917855310-1c08bf6d-6500″][vc_column_text]The CQL MATCH command in NEO4j is used for

  • To get data about properties and nodes from the database
  • To get data about relationship, nodes and properties from the database

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain what is the MATCH command syntax and what is the rule for using it?” tab_id=”1562917856418-a4168eef-1370″][vc_column_text]The syntax for MATCH command is





The rule for using MATCH command is that you cannot use this command alone to fetch data from the database otherwise it will show invalid syntax error.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain what does the SET clause is used for in Neo4j?” tab_id=”1562917857002-f371e22a-41bf”][vc_column_text]Neo4j CQL use SET clause for the following purpose

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

[/vc_column_text][/vc_tta_section][vc_tta_section title=” Explain what Neo4j CQL LIMIT clause is used for?” tab_id=”1562917857552-f0324bf8-e537″][vc_column_text]Neo4j CQL LIMIT clause is used for limit or filter the number of rows return by a query.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention the IN Operator syntax in Neo4i?” tab_id=”1562917857991-af856603-44e3″][vc_column_text]The IN Operator syntax in NEO4j would be something like this

IN[ <Collection-of-values>][/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain how Neo4j stores primitive array?” tab_id=”1562917858627-ebb12890-ec1b”][vc_column_text]Neo4j stores primitive array in a compressed way in order to save the space on disk, to do that it uses a “bit saving” algorithm.[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][/vc_row]

WhatsApp us