Graph Stores Questions with Answers

6 practice questions on Graph Stores (NoSQL & MongoDB) with answers and step-by-step solutions. Try 6 samples below, then practise all 6 free in the AptiNest app.

Sample questions

Question 1Easy

In a property graph, relationships connect which elements?

  1. Tables
  2. Indexes
  3. Nodes
  4. Documents only

Answer: C. Nodes

Explanation

Edges link nodes and can carry properties.

Step-by-step solution

  1. Graph = nodes + edges.

Why the other options are wrong

  • A. Relationships connect nodes in a property graph, not tables.
  • B. Indexes are lookup structures, not elements that relationships connect.
  • D. Relationships connect nodes, not only documents.

Question 2Medium

Which query language is used by Neo4j?

  1. CQL
  2. SPARQL only
  3. Cypher
  4. MQL

Answer: C. Cypher

Explanation

Cypher is Neo4j's declarative graph query language (CQL belongs to Cassandra).

Step-by-step solution

  1. Neo4j is a graph database.
  2. Its query language is Cypher, which uses ASCII-art patterns such as (a)-[:KNOWS]->(b).
  3. So the answer is option C, Cypher.

Why the other options are wrong

  • A. CQL is the query language of Cassandra.
  • B. SPARQL is for RDF triple stores, not Neo4j.
  • D. MQL is the MongoDB query language, not the Neo4j language.

Tip: Query languages: Cypher for Neo4j, CQL for Cassandra, MongoDB query syntax for MongoDB.

Question 3Medium

What does this Cypher query find?

MATCH (a:Person)-[:FRIEND]->(b:Person) RETURN b
  1. All Person nodes in the graph, with or without friends
  2. Only the nodes bound to the variable a
  3. Relationships that are named Person
  4. People who are friends of any person

Answer: D. People who are friends of any person

Explanation

The pattern matches a FRIEND edge from a to b and returns the target b.

Step-by-step solution

  1. Read the pattern left to right.
  2. Return b.

Why the other options are wrong

  • A. Only those with an incoming FRIEND edge.
  • B. The query returns b, the friend nodes, not a.
  • C. Person is a label on nodes.

Question 4Medium

In a property graph, what do nodes and edges store?

  1. Nodes are relationships and edges are tables
  2. Nodes are entities, edges are relationships
  3. Only edges can hold any properties at all
  4. Nodes hold only integer IDs and nothing more

Answer: B. Nodes are entities, edges are relationships

Explanation

Both nodes and relationships carry key-value properties.

Step-by-step solution

  1. Nodes represent entities like people or places.
  2. Edges show connections between these entities.
  3. Both nodes and edges can have properties as key-value pairs.
  4. Properties store information about the entity or connection.
  5. The correct answer is Nodes are entities, edges are relationships.

Why the other options are wrong

  • A. Edges are the relationships, not tables; a graph model has no tables for nodes or edges.
  • C. Nodes can hold properties too, so only edges having properties is not the rule.
  • D. Nodes can store many properties, not just an integer ID.

Question 5Hard

Why are multi-hop traversals fast in native graph databases?

  1. Relationships are stored as direct pointers (index-free adjacency)
  2. They denormalise all data into one big document so no traversal is needed
  3. They run a join on every hop of the traversal
  4. They cache the full graph in memory first

Answer: A. Relationships are stored as direct pointers (index-free adjacency)

Explanation

Following an edge needs no global index lookup.

Step-by-step solution

  1. Edge pointers.
  2. Cost depends on the local neighbourhood.

Why the other options are wrong

  • B. Denormalising is not what makes graph traversals fast.
  • C. Joins would be slower.
  • D. Native graphs do not need the whole graph cached first.

Question 6Hard

Why do graph databases avoid expensive JOINs for relationship traversal?

  1. They keep no relationships
  2. They copy all data into every node
  3. They sort every table first
  4. Relationships are stored as direct links

Answer: D. Relationships are stored as direct links

Explanation

Index-free adjacency lets traversal follow pointers instead of computing joins.

Step-by-step solution

  1. Graph databases store relationships as direct links between nodes.
  2. This allows traversal by following pointers directly.
  3. JOINs are expensive because they require searching and combining data from multiple tables.
  4. Direct links avoid the need for JOIN operations entirely.
  5. Therefore, relationships are stored as direct links.

Why the other options are wrong

  • A. Graph databases do keep relationships; keeping them is the whole point of the model.
  • B. Copying all data into every node would be wasteful and is not how graph stores work.
  • C. Sorting every table is a relational step; graphs follow links instead of sorting tables.

Tip: Remember: direct links = no JOINs needed.

Practise all 6 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all NoSQL & MongoDB topics · All topics