Sample questions
Question 1Easy
In a property graph, relationships connect which elements?
- Tables
- Indexes
- Nodes
- Documents only
Answer: C. Nodes
Explanation
Edges link nodes and can carry properties.
Step-by-step solution
- 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?
- CQL
- SPARQL only
- Cypher
- MQL
Answer: C. Cypher
Explanation
Cypher is Neo4j's declarative graph query language (CQL belongs to Cassandra).
Step-by-step solution
- Neo4j is a graph database.
- Its query language is Cypher, which uses ASCII-art patterns such as (a)-[:KNOWS]->(b).
- 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
- All Person nodes in the graph, with or without friends
- Only the nodes bound to the variable a
- Relationships that are named Person
- 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
- Read the pattern left to right.
- 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?
- Nodes are relationships and edges are tables
- Nodes are entities, edges are relationships
- Only edges can hold any properties at all
- 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
- Nodes represent entities like people or places.
- Edges show connections between these entities.
- Both nodes and edges can have properties as key-value pairs.
- Properties store information about the entity or connection.
- 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?
- Relationships are stored as direct pointers (index-free adjacency)
- They denormalise all data into one big document so no traversal is needed
- They run a join on every hop of the traversal
- 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
- Edge pointers.
- 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?
- They keep no relationships
- They copy all data into every node
- They sort every table first
- 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
- Graph databases store relationships as direct links between nodes.
- This allows traversal by following pointers directly.
- JOINs are expensive because they require searching and combining data from multiple tables.
- Direct links avoid the need for JOIN operations entirely.
- 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 →