Skip to content

Quiz: Graph Database Technologies and Query Languages

Test your understanding of native graph storage, Cypher query language, cycle detection, and pattern matching with these review questions.


1. What is the key architectural feature of native graph storage that enables constant-time O(1) traversal performance per hop?

  1. Native graph databases cache all traversal results in memory so repeated queries never touch disk
  2. Native graph databases use index-free adjacency, storing direct pointers from each node to its connected neighbors
  3. Native graph databases compress relationship data into bitmaps that can be scanned faster than relational indexes
  4. Native graph databases partition data by relationship type so each traversal only scans a single partition
Show Answer

The correct answer is B. Index-free adjacency is the defining architectural characteristic of native graph storage. Each node physically stores direct references (pointers) to its neighboring nodes. Traversing from one node to the next means following a memory pointer—a constant-time operation regardless of the total graph size. This is fundamentally different from a graph layer on a relational database, which must perform index lookups or table scans at every traversal step.

Concept Tested: Native Graph Storage


2. A graph layer built on top of a relational database is likely to exhibit which performance characteristic when executing 6-hop dependency traversals?

  1. Performance equivalent to a native graph database because graph layers add query planning that compensates for underlying storage
  2. Slightly slower than native graph databases but still completing within acceptable response times for operational use cases
  3. Performance similar to the relational database's multi-hop JOIN behavior, degrading exponentially with each additional hop
  4. Faster than native graph databases because relational indexes are more optimized than graph adjacency pointers
Show Answer

The correct answer is C. A graph layer translates graph traversal operations into the underlying storage system's native operations—SQL JOINs for relational databases. This means the graph layer inherits all the performance characteristics of relational multi-hop queries, including exponential degradation as hop count increases. At 6 hops, the graph layer may time out entirely, while a native graph database completes the same traversal in tens of milliseconds.

Concept Tested: Graph Layer


3. In Cypher query language, what does the pattern (app:Application)-[:DEPENDS_ON*1..5]->(db:Database) specify?

  1. Find applications that depend on exactly 5 databases connected through a single relationship
  2. Find paths where one to five DEPENDS_ON relationships connect an Application node to a Database node
  3. Find the first 5 Application nodes that have DEPENDS_ON relationships pointing toward Database nodes
  4. Find applications and databases that have been connected for between 1 and 5 years
Show Answer

The correct answer is B. The *1..5 notation in Cypher specifies a variable-length path—follow between 1 and 5 DEPENDS_ON relationships to reach the target. This pattern matches both direct dependencies (1 hop) and transitive dependencies up to 5 hops deep. This is one of Cypher's most powerful features for dependency analysis, enabling queries that traverse arbitrary-depth relationship chains without writing separate queries for each hop count.

Concept Tested: Cypher Query Language


4. What does cycle detection in a directed IT dependency graph reveal, and why is it architecturally significant?

  1. Cycle detection identifies the longest dependency chain in the graph, useful for estimating deployment durations
  2. Cycle detection finds circular dependencies where component A eventually depends on itself, which complicates deployment order and indicates tight coupling
  3. Cycle detection measures the average number of relationships per node to assess graph density and query complexity
  4. Cycle detection identifies nodes with no inbound relationships, which are candidates for removal from the dependency model
Show Answer

The correct answer is B. Cycle detection identifies circular paths where following directed dependencies eventually returns to the starting node—for example, Service A depends on B, B depends on C, C depends back on A. This creates ambiguity: which component deploys first? Cycles indicate tight coupling that reduces system resilience, complicates change management, and may reveal architectural debt requiring refactoring using patterns like message queues or event-driven interfaces.

Concept Tested: Cycle Detection


5. Which Cypher clause is used to describe the graph pattern you want to find, similar to how SQL's FROM and JOIN clauses specify which tables to access?

  1. RETURN
  2. WHERE
  3. MATCH
  4. WITH
Show Answer

The correct answer is C. The MATCH clause in Cypher is used to describe the graph pattern you want to find. It uses ASCII-art syntax where nodes are represented with parentheses (), relationships with arrows -->, and labels and properties with brackets and curly braces. MATCH is the foundation of most Cypher queries, describing the subgraph pattern to locate in the database before filtering (WHERE), transforming (WITH), or returning (RETURN) results.

Concept Tested: Cypher Query Language


6. Neo4j is described as having a significant limitation in its Community Edition compared to Enterprise Edition. What is that limitation?

  1. The Community Edition does not support the Cypher query language and requires users to write queries in Java
  2. The Community Edition limits graphs to a maximum of 10,000 nodes, making it unsuitable for even small IT estates
  3. The Community Edition runs on a single JVM instance and lacks clustering, making it unsuitable for high-availability production deployments
  4. The Community Edition only supports undirected graphs and cannot model the directed dependency relationships needed for IT management
Show Answer

The correct answer is C. Neo4j Community Edition runs on a single JVM instance without the clustering features available in Enterprise Edition. This means it lacks high availability, horizontal read scalability, and the fault tolerance required for production deployments. The chapter notes that Enterprise Edition licensing can be expensive, making alternatives like MemGraph worth evaluating for production use, while Community Edition remains suitable for pilot projects under approximately one million nodes.

Concept Tested: Neo4j


  1. Pattern matching scans nodes sequentially and applies regular expression filters to property values, similar to SQL's LIKE operator
  2. Pattern matching describes a subgraph template—a specific configuration of nodes and relationships—and finds all instances of that template in the data, rather than imperatively joining tables
  3. Pattern matching uses machine learning to predict which nodes are likely to be related based on historical query patterns
  4. Pattern matching compares two graph snapshots to identify which nodes and relationships have changed between time periods
Show Answer

The correct answer is B. Pattern matching in graph queries works by declaring a subgraph template—a description of the structural pattern you want to find—and asking the database to locate all instances of that pattern. This declarative approach differs fundamentally from SQL's imperative join logic, where you specify which tables to combine and how to match rows. Pattern matching expresses queries in terms of graph structure ("find service-depends-on-app-depends-on-unbackedup-db") rather than table operations.

Concept Tested: Pattern Matching


8. A Cypher query uses shortestPath((start:BusinessService)-[:SUPPORTS|DEPENDS_ON|HOSTED_ON*]->(end:Server)). What does the | operator do in this context?

  1. It creates an OR condition on node properties, returning results where either node matches the specified label
  2. It specifies that the traversal must follow exactly one of the listed relationship types per hop, alternating between them
  3. It allows the traversal to follow any of the listed relationship types (SUPPORTS, DEPENDS_ON, or HOSTED_ON) when moving between nodes
  4. It filters results to include only the paths that use the most common relationship type found in the database
Show Answer

The correct answer is C. In Cypher, the | operator within a relationship pattern [:TYPE1|TYPE2|TYPE3] means "or"—the traversal can follow any of the listed relationship types when moving from one node to the next. This allows the shortestPath function to traverse through a mixed path of SUPPORTS, DEPENDS_ON, and HOSTED_ON relationships, finding the shortest route through any combination of these relationship types connecting the business service to the server.

Concept Tested: Graph Query


9. Which of the following graph query capabilities would be most difficult to replicate in SQL without recursive common table expressions?

  1. Returning a list of all application names sorted alphabetically
  2. Counting how many applications are connected to a specific database
  3. Finding all transitive dependencies of an application to any depth without knowing the maximum depth in advance
  4. Filtering applications by their deployment environment property value
Show Answer

The correct answer is C. Variable-depth traversal—finding all transitive dependencies without knowing the maximum depth—is where graph query languages dramatically outperform SQL. Cypher handles this with DEPENDS_ON* (follow any number of hops) as a single, readable clause. In SQL, this requires recursive CTEs with depth limits and complex loop logic that becomes error-prone and hard to maintain. Simple operations like sorting, counting, and filtering (options A, B, D) are equally straightforward in both SQL and Cypher.

Concept Tested: Graph Query


10. A Cypher query fragment reads MATCH (a:Application)-[dep:DEPENDS_ON {criticality: "HIGH"}]->(b:Application). What does enclosing the relationship in square brackets with a variable name dep allow you to do?

  1. It restricts the traversal to follow only the relationship stored in the first position of the adjacency list
  2. It binds the relationship to the variable dep, allowing you to return, filter on, or access the relationship's own properties in the query
  3. It creates a copy of the relationship stored in a temporary variable used only within the WHERE clause
  4. It forces the query optimizer to use the relationship index rather than the node index when planning the query
Show Answer

The correct answer is B. In Cypher, placing a variable name inside the relationship brackets (like [dep:DEPENDS_ON]) binds that specific relationship instance to the variable dep. This allows you to reference the relationship's properties (e.g., dep.last_tested, dep.criticality) in WHERE clauses, RETURN statements, or aggregation functions later in the query. Without the variable, you can still filter on relationship type and label properties using {criticality: "HIGH"}, but you cannot refer to the relationship itself elsewhere in the query.

Concept Tested: Cypher Query Language