NEO4J-GENAI sample questions with answers

10 free practice questions for the Neo4j and Generative AI Certification exam. Try each one, then open the answer to see why the right option wins and every other option loses.

Question 1GraphRAG & Vectors

A media company already keeps 40 million article embeddings in Pinecone, and each Pinecone record's ID matches an articleId property on the corresponding :Article node in Neo4j, where authors, topics and citations are modelled. The team does not want to copy vectors into Neo4j. Which neo4j-graphrag approach retrieves context that includes the graph neighbourhood?

  1. A.

    Use a PineconeNeo4jRetriever with idpropertyneo4j set to articleId and a retrieval_query that traverses to authors and topics

  2. B.

    Create a Neo4j vector index over :Article nodes and run a VectorCypherRetriever against it, then synchronise it with Pinecone nightly

  3. C.

    Use a HybridRetriever whose full-text index is the Pinecone index and whose vector index is the Neo4j article index

  4. D.

    Use a Text2CypherRetriever and include the Pinecone index name in the schema so the LLM can query both stores in one step

Show answer

Answer: A

The external-store retrievers run the vector search in Pinecone, map hits to Neo4j nodes by an ID property, and accept a retrieval_query.

  • A. Correct: PineconeNeo4jRetriever searches Pinecone, matches hits to nodes by articleId, and a retrieval_query adds the graph neighbourhood.
  • B. Incorrect: this copies the vectors into Neo4j, which the stated constraint rules out, and adds a nightly synchronisation job.
  • C. Incorrect: HybridRetriever needs a Neo4j full-text index and a Neo4j vector index; a Pinecone index can be neither.
  • D. Incorrect: Text2CypherRetriever only runs generated Cypher against Neo4j; it has no way to query a Pinecone index.
Question 2GraphRAG & Vectors

A policy-manual graph links consecutive chunks with (:Chunk)-[:NEXTCHUNK]->(:Chunk). Matched chunks often begin or end mid-thought, so the team wants each retrieved chunk returned with the text of the chunk before and after it. Some hits are the first or last chunk of a document. Which retrievalquery returns every hit with its neighbours?

  1. A.

    MATCH (prev)-[:NEXTCHUNK]->(node)-[:NEXTCHUNK]->(next) RETURN prev.text AS before, node.text AS text, next.text AS after, score

  2. B.

    OPTIONAL MATCH (node)-[:NEXT_CHUNK*1..2]-(n) RETURN node.text AS text, collect(n.text) AS neighbours, score

  3. C.

    MATCH (node)-[:NEXT_CHUNK]-(n) RETURN node.text AS text, collect(n.text) AS neighbours, score

  4. D.

    OPTIONAL MATCH (prev)-[:NEXTCHUNK]->(node) OPTIONAL MATCH (node)-[:NEXTCHUNK]->(next) RETURN prev.text AS before, node.text AS text, next.text AS after, score

Show answer

Answer: D

Two separate OPTIONAL MATCH clauses keep first and last chunks, returning null for the missing neighbour, and preserve before/after order.

  • A. Incorrect: MATCH requires both neighbours, so hits that are the first or last chunk of a document are dropped.
  • B. Incorrect: an undirected one-to-two-hop pattern mixes predecessors and successors in one unordered list and pulls in extra chunks.
  • C. Incorrect: an undirected MATCH loses the before/after order and drops a hit whose document has only one chunk.
  • D. Correct: separate OPTIONAL MATCH clauses keep every hit, returning null for a missing neighbour, and keep before and after distinct.
Question 3GraphRAG & Vectors

A developer's VectorCypherRetriever returns each chunk's text and a list of related regulations. His resultformatter puts the chunk text in content and the regulations in metadata, to keep the prompt tidy. With returncontext=True he can see the regulations on every item, yet the LLM's answers never mention them. Why?

  1. A.

    GraphRAG builds the prompt context from each item's content only; metadata is never sent to the LLM

  2. B.

    The regulations list is converted to a string before prompting, and the LLM ignores list syntax

  3. C.

    Metadata is sent, but only for the first item, because RetrieverResult keeps one metadata dictionary

  4. D.

    The RagTemplate default instructions tell the LLM to ignore metadata unless the question asks about it

Show answer

Answer: A

Only RetrieverResultItem.content becomes LLM context; metadata is for the application, not the prompt.

  • A. Correct: GraphRAG joins item.content values into the context; metadata stays with the result and never reaches the LLM.
  • B. Incorrect: the regulations never reach the prompt at all, so their string representation is irrelevant.
  • C. Incorrect: every item has its own metadata, and none of it, for any item, is included in the prompt.
  • D. Incorrect: the default RagTemplate instruction is only 'Answer the user question using the provided context.'
Question 4GraphRAG & Vectors

A law firm's graph stores contract clauses as embedded Chunk nodes linked by (:Chunk)-[:INCONTRACT]->(:Contract)-[:WITHPARTY]->(:Party). Lawyers ask 'Which clauses resemble a broad non-compete, and which counterparties signed those contracts?' The question has no names, codes or numbers in it. Which retriever returns the right context most reliably?

  1. A.

    HybridCypherRetriever, because combining full-text and vector search always improves recall over vector search alone

  2. B.

    VectorRetriever, with return_properties set to the clause text so that the LLM can infer the counterparties from the clause wording

  3. C.

    Text2CypherRetriever, because the relationship path to Party is known and an LLM can write a query that follows it

  4. D.

    VectorCypherRetriever, with a retrieval_query that returns each clause's text and the parties reached via its contract

Show answer

Answer: D

The entry point is semantic (clauses resembling a concept) and the follow-up is a fixed traversal, which is the vector-then-traverse pattern.

  • A. Incorrect: with no names, codes or numbers in the questions, the full-text half adds noise; 'always improves recall' is not a documented guarantee.
  • B. Incorrect: party names live on Party nodes, not in the clause properties, so the LLM would have to guess them.
  • C. Incorrect: a generated query can follow the path, but it can only express 'resembles a non-compete' with keyword predicates that miss paraphrases.
  • D. Correct: vector search finds semantically similar clauses and the retrieval_query traverses to the parties of each clause's contract.
Question 5GraphRAG & Vectors

A developer's VectorCypherRetriever (topk=5) returns thousands of records per question, most of them chunks unrelated to the question. His retrievalquery reads 'MATCH (chunk)-[:FROMDOCUMENT]->(d:Document) RETURN chunk.text AS text, d.path AS source, score'. The index name, embedder and driver are correct. What is wrong with the retrievalquery?

  1. A.

    It returns a property of a related Document node, which the retriever expands into every chunk of that document

  2. B.

    It must begin with a WITH clause that re-declares the score variable before any MATCH clause is allowed

  3. C.

    It needs a CALL subquery with a variable scope clause, otherwise the MATCH ignores the LIMIT applied to top_k

  4. D.

    It introduces a new variable chunk that matches every chunk in the graph, instead of starting from node

Show answer

Answer: D

The vector hit is bound as node; a MATCH on a fresh variable called chunk matches all chunks and multiplies them with the five hits.

  • A. Incorrect: returning a related node's property yields one value per row; it does not pull in the document's other chunks.
  • B. Incorrect: node and score are already in scope when the retrieval_query begins; a MATCH can come first.
  • C. Incorrect: a single-hop MATCH from node needs no CALL subquery; the problem is that the MATCH never starts from node.
  • D. Correct: a fresh variable is not tied to the vector hits, so the MATCH binds every chunk in the graph and multiplies the rows.
Question 6GraphRAG & Vectors

A production assistant uses a Text2CypherRetriever inside GraphRAG. Occasionally the LLM produces a statement that is not valid Cypher, and the whole request fails with an unhandled exception. The team wants such requests to fall back to a vector search instead of failing. Which exception should the application catch?

  1. A.

    EmbeddingRequiredError, which is raised because Text2CypherRetriever has no embedder configured

  2. B.

    CypherSyntaxError from the Neo4j driver, which the retriever re-raises without wrapping it

  3. C.

    Text2CypherRetrievalError, which the retriever raises when the generated query cannot be executed

  4. D.

    RetrieverInitializationError, which the retriever raises whenever any query it sends fails on the database

Show answer

Answer: C

The retriever wraps a failed generated query in Text2CypherRetrievalError.

  • A. Incorrect: Text2CypherRetriever does not use an embedder, so EmbeddingRequiredError cannot arise from it.
  • B. Incorrect: the retriever catches the driver's CypherSyntaxError and re-raises it as its own exception type.
  • C. Correct: Text2CypherRetrievalError is the documented exception when the generated query cannot be executed.
  • D. Incorrect: RetrieverInitializationError signals invalid constructor arguments, not a failure during search.
Question 7GraphRAG & Vectors

A pharmaceutical safety team embeds adverse-event report chunks in Neo4j. Analysts search by drug codes such as 'ZX-114' and by vague symptom descriptions, and each answer must list the manufacturer, which is reachable only through (:Chunk)-[:ABOUT]->(:Drug)-[:MADE_BY]->(:Manufacturer). A full-text index on chunk text already exists. Which retriever satisfies every requirement?

  1. A.

    HybridRetriever with return_properties listing the chunk text and the manufacturer property, so both indexes contribute to every answer

  2. B.

    HybridCypherRetriever with a retrievalquery that follows ABOUT and MADEBY from node to return the manufacturer's name

  3. C.

    Text2CypherRetriever with a schema describing Chunk, Drug and Manufacturer and examples of drug-code questions

  4. D.

    VectorCypherRetriever with a retrievalquery that follows ABOUT and MADEBY to return the manufacturer's name

Show answer

Answer: B

Only HybridCypherRetriever combines keyword matching for drug codes, semantic matching for symptoms and a traversal to the manufacturer.

  • A. Incorrect: HybridRetriever has no retrieval_query, and the manufacturer is not a property of the chunk node, so return_properties cannot reach it.
  • B. Correct: it combines vector and full-text search, and its retrieval_query traverses from each hit to the manufacturer.
  • C. Incorrect: Text2CypherRetriever performs no similarity search, so vague symptom descriptions would not be matched semantically.
  • D. Incorrect: it provides semantic search and the traversal but no full-text index, so exact drug-code searches rely on embeddings that blur identifiers.
Question 8GraphRAG & Vectors

A platform engineer instantiates a HybridRetriever for a documentation graph by passing the driver, the name of the existing vector index 'doc_embeddings' and an embedder, following a VectorRetriever snippet. The constructor rejects the arguments. What else must be supplied for a HybridRetriever to be created correctly?

  1. A.

    An LLM object, because the retriever asks the LLM to merge and re-rank the vector and keyword result lists

  2. B.

    A retrieval_query string that starts from node and returns the properties the LLM should see

  3. C.

    A second embedder, because the full-text half of the search needs its own vector representation

  4. D.

    The name of a Neo4j full-text index, which must already exist in the database, as fulltextindexname

Show answer

Answer: D

HybridRetriever searches a vector index and a full-text index, so it needs the names of both, and the full-text index must exist.

  • A. Incorrect: score merging is done in the generated Cypher query, not by an LLM; HybridRetriever takes no LLM.
  • B. Incorrect: a retrieval_query is a HybridCypherRetriever parameter; HybridRetriever does not take one.
  • C. Incorrect: full-text search is lexical and uses no embeddings, so a second embedder has nothing to do.
  • D. Correct: HybridRetriever needs both index names, and the full-text index must already exist in the database.
Question 9GraphRAG & Vectors

Users report that a GraphRAG assistant built on a VectorCypherRetriever gives answers that ignore obviously relevant facts in the graph. The developer wants to see, for a failing question, exactly which records the retriever passed to the LLM without adding logging code. What should she do?

  1. A.

    Set retrieverconfig={'topk': 0} so that the retriever returns its generated Cypher query instead of records

  2. B.

    Call rag.search(q, response_fallback='debug') to print the context instead of an answer

  3. C.

    Call rag.search(q, returncontext=True) and inspect retrieverresult on the response

  4. D.

    Replace the LLM with a LangChain chat model, which echoes its full prompt back as the answer when a question is asked

Show answer

Answer: C

return_context=True makes GraphRAG include the retriever result in its response alongside the answer.

  • A. Incorrect: top_k=0 retrieves nothing, and only Text2CypherRetriever exposes a generated Cypher query, in its metadata.
  • B. Incorrect: response_fallback is returned in place of an answer only when the retrieved context is empty; it prints nothing.
  • C. Correct: return_context=True attaches the RetrieverResult to the response so the retrieved items can be inspected.
  • D. Incorrect: LangChain chat models generate answers like any LLM; they do not echo their prompts back.
Question 10GraphRAG & Vectors

A retrievalquery written for an older Neo4j release contains 'CALL { WITH node MATCH (node)<-[:FROMCHUNK]-(e:Entity) RETURN collect(e.name) AS entities } RETURN node.text AS text, entities, score'. On a current release the team sees a deprecation notification for this query. How should the subquery be written?

  1. A.

    CALL (node) { MATCH (node)<-[:FROM_CHUNK]-(e:Entity) RETURN collect(e.name) AS entities }

  2. B.

    CALL { MATCH (node)<-[:FROM_CHUNK]-(e:Entity) RETURN collect(e.name) AS entities }, since node is imported automatically

  3. C.

    CALL (*) { WITH node MATCH (node)<-[:FROM_CHUNK]-(e:Entity) RETURN collect(e.name) AS entities }, keeping the WITH

  4. D.

    CALL { WITH node WHERE node IS NOT NULL MATCH (node)<-[:FROM_CHUNK]-(e:Entity) RETURN collect(e.name) AS entities }

Show answer

Answer: A

Current Cypher imports outer variables with a variable scope clause, CALL (node) { … }; the importing WITH form is deprecated.

  • A. Correct: the variable scope clause (node) imports node explicitly, which is the non-deprecated syntax.
  • B. Incorrect: without a scope clause or importing WITH, node is not imported, and a CALL without a scope clause is deprecated.
  • C. Incorrect: using a scope clause disables the importing WITH, so keeping WITH node inside the braces is not the fix.
  • D. Incorrect: an importing WITH is deprecated, and the manual says it cannot be followed by WHERE.

Keep going with 506 more NEO4J-GENAI questions

Free papers every day, in the real exam formats, with progress by exam domain. Unlock every paper and timed mock exam when you are ready.

NEO4J-GENAI sample questions with answers (10 free) · CertifyAIx