First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Cypher
In Cypher, which clause is used to filter rows produced by a MATCH before they are returned or aggregated?
- WITH
- WHERE Correct answer.
- HAVING
- FILTER
Explanation
WHERE attaches to MATCH, OPTIONAL MATCH and WITH and removes rows whose predicate does not evaluate to true. It is the standard filtering clause in Cypher and cannot stand alone as a statement.
Question 2Cypher
Which pattern correctly matches a Person node that has an outgoing FRIEND relationship to another Person node in Cypher?
- (a:Person)-[:FRIEND]-(b:Person)
- (a:Person)<-[:FRIEND]-(b:Person)
- (a:Person)-[FRIEND]-(b:Person)
- (a:Person)-[:FRIEND]->(b:Person) Correct answer.
Explanation
Relationship patterns place the relationship type inside square brackets after a colon and use an arrow to fix direction. The arrow pointing right means the relationship starts at a and ends at b.
Question 3Cypher
You run MATCH (n:Movie) RETURN n.title AS title ORDER BY title. What is the effect of the ORDER BY clause on the result?
- Rows are sorted by the property n.title but the alias title is ignored.
- Rows are sorted descending by title because no direction is given.
- Rows are sorted ascending by the value of the projected alias title. Correct answer.
- Rows are sorted in the order the nodes were created.
Explanation
ORDER BY sorts the output rows and may reference aliases introduced in the preceding RETURN or WITH. With no ASC or DESC keyword the default is ascending order.
Question 4Cypher
Which Cypher clause creates a node and returns it in a single statement?
- MATCH (p:Person) CREATE p RETURN p
- MERGE (p:Person) RETURN p
- CREATE (p:Person {name: 'Ada'}) RETURN p Correct answer.
- INSERT (p:Person {name: 'Ada'}) RETURN p
Explanation
CREATE builds the pattern described in the clause and RETURN projects the newly created entity. MERGE behaves differently because it first attempts to match an existing pattern.
Question 5Cypher
What does the Cypher function count(*) return in MATCH (p:Person) RETURN count(*)?
- The number of non-null values in the first column of the result
- The number of distinct Person nodes only
- The number of matched rows, including rows where all returned values are null Correct answer.
- The number of properties on each Person node
Explanation
count(*) counts rows rather than values, so null values in those rows do not reduce the total. In contrast, count(expression) skips nulls in that expression.
Question 6Cypher
Which statement about MATCH (n) RETURN n.name, n.age is true?
- Rows with a null name are silently dropped from the result.
- Both properties are projected, and rows whose name is null are still returned. Correct answer.
- The query fails because two properties cannot be returned together.
- The query returns a map with exactly two keys, name and age.
Explanation
Property access on a node yields null when the property is absent, and null values are still projected as rows. Only filtering clauses such as WHERE or aggregation functions remove or skip nulls.
Question 7Cypher
Which Cypher clause is required to introduce a variable that can be used by a following MATCH clause without returning intermediate results to the client?
- UNWIND
- RETURN
- CALL
- WITH Correct answer.
Explanation
WITH pipes results from one query part into the next and can alias, aggregate and filter expressions along the way. RETURN ends the query and sends results to the client instead.
Question 8Cypher
Which Cypher literal correctly represents a map value with two keys?
- ['Ada', 36]
- {name: 'Ada', age: 36} Correct answer.
- ('Ada', 36)
- {'Ada': 36}
Explanation
Map literals use curly braces with key-value pairs separated by colons and commas. Square brackets denote lists and parentheses denote patterns or grouping.
Question 9Cypher
You want to update an existing node's property only when a match exists and do nothing otherwise. Which clause combination achieves this?
- CREATE (p:Person {id: 1, active: true})
- MERGE (p:Person {id: 1}) SET p.active = true
- MATCH (p:Person {id: 1}) SET p.active = true Correct answer.
- MATCH (p:Person {id: 1}) CREATE p.active = true
Explanation
MATCH produces no rows when nothing matches, so the following SET never executes and no data is written. MERGE would instead create a node when the match fails.
Question 10Cypher
What is the result of MATCH (a:Person)-[:KNOWS]->(b:Person) RETURN a.name, collect(b.name) AS friends?
- One row per Person a, with a list of the names of all b nodes related to a Correct answer.
- One row per KNOWS relationship, with a single friend name
- A single row containing all names from both a and b
- One row per Person b, grouped by the friend's name
Explanation
When RETURN mixes a grouping key with an aggregation, rows are grouped by the non-aggregated expressions. collect gathers the per-group values into a list, so each a yields one row.
Question 11Cypher
Which query returns each Person and the number of movies they acted in, including people with zero movies?
- MATCH (p:Person) RETURN p.name, count(p) AS movies
- MATCH (p:Person) MATCH (p)-[:ACTED_IN]->(m:Movie) RETURN p.name, count(m) AS movies
- MATCH (p:Person) OPTIONAL MATCH (p)-[:ACTED_IN]->(m:Movie) RETURN p.name, count(m) AS movies Correct answer.
- MATCH (p:Person)-[:ACTED_IN]->(m:Movie) RETURN p.name, count(m) AS movies
Explanation
OPTIONAL MATCH preserves rows from the left side even when the pattern does not match, and count(m) ignores the resulting nulls, giving zero. A plain MATCH would drop people with no relationships.
Question 12Cypher
What does MERGE (p:Person {email: '[email protected]'}) ON CREATE SET p.created = timestamp() do?
- Matches an existing Person and overwrites its created property
- Matches an existing Person with that email, or creates one and sets created only in the create case Correct answer.
- Always creates a new Person and sets the created property
- Creates a Person only if no Person nodes exist in the graph at all
Explanation
MERGE matches the entire pattern or creates it, and ON CREATE SET runs only on the creation path. ON MATCH SET is the counterpart that runs when the pattern already exists.
Question 13Cypher
Which query deletes a Person node together with all of its relationships?
- MATCH (p:Person {id: 1}) DETACH DELETE p Correct answer.
- MATCH (p:Person {id: 1}) DELETE p
- MATCH (p:Person {id: 1}) SET p = null
- MATCH (p:Person {id: 1}) REMOVE p
Explanation
DETACH DELETE removes the node and all relationships attached to it in one step. A plain DELETE fails when the node still has relationships.
Question 14Cypher
Which expression returns the labels of a node bound to the variable n?
- properties(n)
- type(n)
- labels(n) Correct answer.
- keys(n)
Explanation
labels(n) returns the list of label strings attached to a node. type() is for relationships, while keys() and properties() deal with property maps.
Question 15Cypher
What does the Cypher predicate (a)-[:KNOWS*1..3]->(b) mean in a MATCH pattern?
- a is connected to b by exactly three KNOWS relationships
- a reaches b only through a single KNOWS relationship
- a reaches b through a chain of one to three KNOWS relationships Correct answer.
- a and b are the same node at distance one
Explanation
A variable-length pattern with *1..3 matches paths whose length is between one and three relationships of the given type. The bounds are inclusive, and the default relationship uniqueness applies within each path.
Question 16Cypher
Which clause turns a list value into one row per element in Cypher?
- UNWIND Correct answer.
- WITH
- COLLECT
- FOREACH
Explanation
UNWIND expands a list into a stream of rows, one per element, which can then be matched or returned. FOREACH iterates for side effects but does not produce rows.
Question 17Cypher
What is the difference between = and =~ in a Cypher WHERE clause?
- = assigns a property, while =~ compares two nodes
- = tests string containment, while =~ tests numeric equality
- = tests equality, while =~ performs a regular expression match on a string Correct answer.
- Both operators are interchangeable for string comparison
Explanation
The = operator compares two values for equality, whereas =~ matches a string against a Java-style regular expression. The regular expression pattern must match the entire string.
Question 18Cypher
Given MATCH (p:Person) RETURN p.name AS name ORDER BY name DESC SKIP 10 LIMIT 5, which rows are returned?
- Rows 1 through 5 of the descending name order
- Rows 11 through 15 of the descending name order Correct answer.
- Rows 11 through 15 of the ascending name order
- Rows 10 through 14 of the descending name order
Explanation
ORDER BY sorts first, SKIP discards the first ten sorted rows, and LIMIT then keeps the next five. The result therefore starts at the eleventh row of the sorted order.
Question 19Cypher
Which query correctly creates a relationship between two existing nodes found by MATCH?
- MERGE (a:Person {name:'A'})-[:KNOWS]->(b:Person {name:'B'})
- MATCH (a:Person {name:'A'}), (b:Person {name:'B'}) CREATE (a)<-[:KNOWS]-(b) RETURN a
- CREATE (a:Person {name:'A'})-[:KNOWS]->(b:Person {name:'B'})
- MATCH (a:Person {name:'A'}), (b:Person {name:'B'}) CREATE (a)-[:KNOWS]->(b) Correct answer.
Explanation
Two comma-separated node patterns in MATCH bind a and b, and CREATE adds the directed KNOWS relationship between them. CREATE with full node patterns would instead insert new nodes.
Question 20Cypher
What does WITH allow, unlike a plain final RETURN, when continuing a Cypher query into a new query part?
- Sorting the result set before it is returned
- Filtering rows with a predicate
- Returning multiple columns in one projection
- Continuing the query with further MATCH or RETURN clauses using the projected variables Correct answer.
Explanation
WITH ends one query part and passes its projected variables into the next, enabling multi-stage queries. A plain final RETURN ends the query and sends results to the client.
Question 21Cypher
A query uses MATCH (a)-[r]->(b) WHERE r.since > 2020 RETURN a, b. Which statement about the WHERE placement is correct?
- The predicate is applied after projection and only affects the display of r.
- The predicate filters matched rows before projection, so only relationships satisfying it contribute to the result. Correct answer.
- The predicate is invalid because relationship properties cannot be referenced in WHERE.
- The predicate is evaluated once per query, not per row.
Explanation
WHERE attached to MATCH is evaluated per matched row and eliminates rows that fail the predicate. Relationship properties are ordinary properties and can be referenced through the bound variable r.
Question 22Cypher
Which Cypher expression returns the number of elements in a list bound to the variable xs?
- len(xs)
- count(xs)
- length(xs)
- size(xs) Correct answer.
Explanation
size() returns the number of elements in a list and also works on strings and pattern expressions. count() is an aggregation over rows, not a list-length function.
Question 23Cypher
What happens when a Cypher query contains MATCH (n:Missing) RETURN n and no node carries the label Missing?
- The query raises an error because the label does not exist.
- The query returns a single row containing null.
- The query creates a placeholder node with the label Missing.
- The query returns zero rows and no error. Correct answer.
Explanation
Labels and relationship types do not need to be declared, and a pattern that matches nothing simply produces an empty result. Cypher does not treat an unknown label as an error.
Question 24Cypher
Which query correctly uses a parameter to filter nodes by name in Cypher?
- MATCH (p:Person) WHERE p.name = $name RETURN p Correct answer.
- MATCH (p:Person) WHERE p.name = {name} RETURN p
- MATCH (p:Person) WHERE p.name = ?name RETURN p
- MATCH (p:Person) WHERE p.name = :name RETURN p
Explanation
Cypher parameters are referenced with a dollar sign followed by the parameter name and are supplied separately from the query text. This keeps values out of the query string and allows plan reuse.
Question 25Cypher
A query uses MATCH (p:Person) WITH p.name AS name, count(*) AS c WHERE c > 1 RETURN name. Which statement describes the evaluation order?
- The query is invalid because WHERE cannot follow WITH.
- The WHERE filters the Person nodes before any grouping occurs.
- The WHERE is applied after RETURN and cannot reference c.
- Rows are grouped and aggregated, the WHERE on the WITH filters aggregated rows, then name is returned. Correct answer.
Explanation
WITH can carry its own WHERE, which is evaluated against the projected and aggregated results of that WITH. Filtering on an aggregate therefore requires placing the predicate after the aggregation in WITH, not in the MATCH.
Question 26Cypher
A Cypher query begins with MATCH (m:Movie) WHERE m.year > 2000. Which clause must appear before the query can return results to the client?
- WITH
- RETURN Correct answer.
- CREATE
- UNWIND
Explanation
A read query must end with a clause that produces the result stream, and RETURN is the standard clause that projects expressions into the output columns. Without RETURN (or a write clause that completes the query) the statement is incomplete and fails to parse.
Question 27Cypher
Which Cypher clause is used to define the pattern that the query should search for in the graph?
- SET
- FOREACH
- MATCH Correct answer.
- REMOVE
Explanation
MATCH describes a pattern of nodes and relationships and instructs the engine to find all matching paths in the graph. SET and REMOVE modify properties and labels, while FOREACH applies updates per list element.
Question 28Cypher
What is the effect of the Cypher clause CREATE (p:Person {name: 'Ada'})?
- It creates the node only when no Person with that name exists.
- It creates the node and an index on the name property.
- It updates the name of every existing Person node.
- It always creates a new Person node, even if an identical one already exists. Correct answer.
Explanation
CREATE is unconditional: each execution adds a new node regardless of existing data. Deduplication requires MERGE, which matches first and creates only when nothing is found.
Question 29Cypher
Which Cypher keyword begins a clause that filters rows using a predicate after a MATCH?
- SKIP
- LIMIT
- ORDER BY
- WHERE Correct answer.
Explanation
WHERE attaches a boolean predicate to MATCH, OPTIONAL MATCH or WITH and keeps only rows for which the predicate evaluates to true. ORDER BY, SKIP and LIMIT affect row order and count rather than filtering by predicate.
Question 30Cypher
In Cypher, which symbol sequence represents a directed relationship from the variable a to the variable b?
- (a)-[r]-(b)
- (a)-[r]->(b) Correct answer.
- (a)<-[r]-(b)
- (a)-->(b)
Explanation
The arrowhead after the bracket indicates direction from the left node to the right node, so (a)-[r]->(b) traverses outward from a to b. The other forms either reverse direction or leave it unspecified.
Question 31Cypher
Which Cypher function returns the number of rows in a group?
- size(*)
- count(*) Correct answer.
- sum(*)
- length(*)
Explanation
count(*) is an aggregating function that counts rows, including rows where values are null. size() and length() operate on lists, strings or paths, and sum() adds numeric values rather than counting rows.
Question 32Cypher
Which clause removes a property from a node without deleting the node itself?
- DROP
- DETACH DELETE
- DELETE
- REMOVE Correct answer.
Explanation
REMOVE deletes properties (or labels) from an entity while leaving the entity in the graph. Setting the property to null has the same effect on a property. DELETE removes whole nodes or relationships.
Question 33Cypher
Which Cypher clause assigns a new value to an existing property on a matched node?
- CALL
- SET Correct answer.
- WITH
- MERGE
Explanation
SET is the clause that writes property values, labels or maps onto already-bound entities. MERGE can create or match but is not the dedicated property-update clause, and WITH and CALL do not assign properties.
Question 34Cypher
A query runs MATCH (p:Person) RETURN p.name, p.age ORDER BY p.age. What ordering do the returned rows follow?
- The order in which the nodes were created
- Ascending name, because name is projected first
- Ascending age, with null ages placed last Correct answer.
- Descending age, with null ages placed first
Explanation
ORDER BY without DESC sorts ascending, and in Neo4j null values sort after all non-null values in ascending order. The projection order of columns has no influence on sorting, and storage order is irrelevant once ORDER BY is present.
Question 35Cypher
Which expression tests whether a node bound to n has the label Movie?
- labels(n) = 'Movie'
- hasLabel(n, 'Movie')
- n:Movie Correct answer.
- n.label = 'Movie'
Explanation
The colon predicate n:Movie evaluates to true when the node carries that label and can be used in WHERE or CASE. labels(n) returns a list, so comparing it directly with a string is not equivalent.
Question 36Cypher
What does the Cypher pattern (a)-[:KNOWS*2..4]->(b) require?
- At least four KNOWS relationships in any direction
- Exactly two KNOWS relationships followed by four arbitrary ones
- A path of two to four KNOWS relationships from a to b Correct answer.
- A single KNOWS relationship with property value between 2 and 4
Explanation
The asterisk introduces variable-length traversal, and the range 2..4 bounds the number of hops, so paths of length two, three or four qualify. Direction still follows the arrow, and the numbers describe hop count rather than property values.
Question 37Cypher
A query is MATCH (p:Person) RETURN p.city AS city, count(*) AS n ORDER BY n DESC LIMIT 3. What does it produce?
- The three people with the highest city values
- All cities, sorted by name, limited to three rows per city
- The three cities with the most people, sorted from most to fewest Correct answer.
- The three cities with the fewest people
Explanation
GROUP BY is implicit: every non-aggregated expression becomes a grouping key, so rows are grouped by city and counted. ORDER BY n DESC sorts the groups by count descending, and LIMIT 3 keeps the top three.
Question 38Cypher
Which query returns every Person, using null for the movie title when the person has not acted in any movie?
- MATCH (p:Person) RETURN p.name, null AS title
- MATCH (p:Person) OPTIONAL MATCH (p)-[:ACTED_IN]->(m:Movie) RETURN p.name, m.title Correct answer.
- MATCH (p:Person), (m:Movie) RETURN p.name, m.title
- MATCH (p:Person) MATCH (p)-[:ACTED_IN]->(m:Movie) RETURN p.name, m.title
Explanation
OPTIONAL MATCH preserves rows from the preceding part of the pattern and binds null to variables that find no match, so people without movies still appear. A plain MATCH would drop those rows entirely.
Question 39Cypher
What does the WITH clause do when it is followed by WHERE?
- It stores intermediate results as temporary nodes
- It filters only the final output rows sent to the client
- It replaces RETURN in a write-only query
- It filters the intermediate results before the next clause runs Correct answer.
Explanation
WITH passes results from one query part to the next and can carry its own WHERE, which filters before subsequent clauses execute. This differs from filtering after aggregation or after the final projection.
Question 40Cypher
Which function returns the type name of a relationship bound to the variable r?
- kind(r)
- labels(r)
- type(r) Correct answer.
- name(r)
Explanation
type(r) returns the relationship type as a string such as 'ACTED_IN'. labels() applies to nodes, and name() and kind() are not Cypher functions for relationship types.
Question 41Cypher
What is returned by the expression coalesce(null, 'x', 'y') in Cypher?
- null
- 'y'
- 'x' Correct answer.
- A list containing 'x' and 'y'
Explanation
coalesce returns its first non-null argument, scanning left to right. Since the first argument is null and the second is 'x', evaluation stops there and the remaining argument is ignored.
Question 42Cypher
A query uses MATCH (n:Person) WHERE n.age > 30 SET n.verified = true. What is the result?
- The property is set on every matched Person older than 30, and the query returns no rows Correct answer.
- A new Person node is created for each match
- The query fails because SET requires a preceding RETURN
- The property is set on all Person nodes regardless of age
Explanation
SET applies to the rows produced by MATCH and WHERE, so only qualifying nodes are updated. A write query without RETURN completes successfully and produces no result rows.
Question 43Cypher
Which Cypher clause is used to iterate over a list and execute update operations for each element?
- YIELD
- UNWIND
- FOREACH Correct answer.
- CALL
Explanation
FOREACH takes a list and runs the enclosed updating clauses once per element. UNWIND turns a list into rows for further matching and returning, which is a different purpose.
Question 44Cypher
Given MATCH (n) RETURN n.name AS name UNION MATCH (m) RETURN m.name AS name, what is the behaviour of the result?
- The two parts must return differently named columns
- Duplicate name values are kept, with rows from both parts
- Duplicate name values are removed from the combined result Correct answer.
- The second part is ignored when the first returns rows
Explanation
UNION combines the results of two queries and removes duplicate rows, whereas UNION ALL keeps duplicates. Both parts must return the same number of columns with compatible types and the same column names.
Question 45Cypher
Which predicate checks whether a value exists as an element of the list bound to xs?
- xs CONTAINS value
- value IN xs Correct answer.
- value OF xs
- xs HAS value
Explanation
The IN operator tests list membership and returns a boolean, and it can be used in WHERE and CASE expressions. CONTAINS tests substring presence in a string rather than list membership.
Question 46Cypher
A query uses MATCH (p:Person) WITH p.city AS city, collect(p.name) AS names WHERE size(names) > 2 RETURN city, names. Which statement about this query is correct?
- The collect call fails because it appears inside WITH
- The WHERE filters aggregated groups, not individual people Correct answer.
- The query returns every person, not one row per city
- The WHERE filters individual Person nodes before aggregation
Explanation
When WHERE follows an aggregating WITH, it is evaluated on the aggregated rows, so it can reference aggregate results such as size(names). Filtering individual nodes would require the WHERE to precede the aggregation.
Question 47Cypher
Which query correctly merges a relationship only when both endpoint nodes already exist, without creating new nodes?
- MERGE (a:Person {name: 'A'}) MERGE (b:Person {name: 'B'}) CREATE (a)-[:KNOWS]->(b)
- MATCH (a:Person {name: 'A'}), (b:Person {name: 'B'}) MERGE (a)-[:KNOWS]->(b) Correct answer.
- MERGE (a:Person {name: 'A'})-[:KNOWS]->(b:Person {name: 'B'})
- CREATE (a:Person {name: 'A'})-[:KNOWS]->(b:Person {name: 'B'})
Explanation
Matching both endpoints first binds existing nodes, and MERGE then adds only the relationship if it is missing. A MERGE containing whole node patterns would create missing nodes, and CREATE would duplicate the relationship.
Question 48Cypher
What happens when a query uses MATCH (n:Person) WHERE n.age > 30 RETURN n.name and some Person nodes have a null age?
- Those nodes are excluded because null comparisons do not evaluate to true Correct answer.
- The query fails with a type error on the null values
- Those nodes are included because null is treated as zero
- Those nodes are included only when ORDER BY is absent
Explanation
In Cypher, any comparison involving null yields null, and WHERE keeps only rows where the predicate is true. Nodes with null age therefore never satisfy n.age > 30 and are filtered out.
Question 49Cypher
A query uses MATCH (a)-[r]->(b) WITH a, b, count(r) AS rels WHERE rels > 1 RETURN a, b. What does the grouping key consist of?
- Only the relationship count
- The pair of nodes a and b Correct answer.
- All relationships traversed in the pattern
- Only the node a
Explanation
Every non-aggregated expression in the WITH projection becomes a grouping key, so a and b together define each group and count(r) is computed per pair. Relationships are consumed by the aggregation rather than grouped.
Question 50Cypher
Which statement about the scope of variables across a WITH clause is correct?
- All variables from earlier clauses remain available automatically
- Only variables named in the WITH projection remain available to later clauses Correct answer.
- Variables named in WITH become global for the whole session
- Variables are visible only inside the clause that created them
Explanation
WITH acts as a boundary that projects a new scope, so any variable not listed in the projection is dropped and cannot be referenced afterwards. This is why queries that need a variable later must carry it through the WITH.