


















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































































Question 1. Which component of the property graph model defines the category of a node? A) Property B) Label C) Relationship type D) Index Answer: B Explanation: Labels are used to group nodes into categories (e.g., :Person, :Movie) and are the primary way to identify node types in Neo4j. Question 2. In Neo4j, which of the following best describes a relationship direction? A) Relationships have no direction. B) Direction is only for visualization. C) Direction determines how patterns are matched in queries. D) Direction can be changed after creation without rewriting the relationship. Answer: C Explanation: The arrow (-> or <-) in a pattern tells the query engine which direction to follow when matching relationships. Question 3. Which of the following is a primary advantage of graph databases over relational databases for connected data? A) Automatic sharding of data. B) Faster deep‑traversal queries without joins. C) Built‑in support for ACID transactions. D) Unlimited column families. Answer: B
Explanation: Graph databases store relationships as first‑class citizens, enabling efficient traversal of many hops without costly join operations. Question 4. Which file type stores the actual node and relationship records on disk in Neo4j? A) .conf file B) Store files (e.g., neostore.nodestore.db) C) Log files D) Index files Answer: B Explanation: Neo4j’s “store files” contain the persistent representation of nodes, relationships, and their properties. Question 5. What is the purpose of the Node Cache in Neo4j’s architecture? A) To cache Cypher query plans. B) To store recently accessed node records in memory for faster reads. C) To hold backup copies of the database. D) To cache HTTP responses from the REST API. Answer: B Explanation: The Node Cache keeps hot node data in RAM, reducing disk I/O during query execution. Question 6. In a Neo4j causal cluster, which component is responsible for leader election? A) Core members only B) Read replicas only C) The HA proxy
Answer: B Explanation: WHERE applies predicates to the matched pattern before returning results. Question 10. What does the DETACH DELETE statement do? A) Deletes a node only if it has no relationships. B) Deletes a node and all its incident relationships. C) Deletes a relationship and its connected nodes. D) Removes a node label without deleting the node. Answer: B Explanation: DETACH DELETE removes a node and automatically removes any relationships attached to it. Question 11. Which Cypher keyword ensures that a pattern is created only if it does not already exist? A) CREATE B) MERGE C) OPTIONAL MATCH D) UNION Answer: B Explanation: MERGE attempts to match a pattern; if it fails, it creates the pattern, guaranteeing idempotent behavior.
Question 12. Which regular expression operator is used in Cypher to test pattern matching? A) =~ B) =~= C) LIKE D) REGEXP Answer: A Explanation: The =~ operator applies a Java regular expression to a string value. Question 13. How do you sort query results by the property age in descending order? A) ORDER BY age DESC B) SORT age DESCENDING C) ORDER BY age DOWN D) SORT BY age DESC Answer: A Explanation: ORDER BY followed by the property and the keyword DESC sorts results descending. Question 14. Which aggregation function returns the number of distinct values of a property? A) count() B) sum() C) avg() D) count(DISTINCT ...) Answer: D Explanation: Using count(DISTINCT n.age) counts only unique values of n.age.
Question 18. Which Cypher clause can be used to view the execution plan without running the query? A) EXPLAIN B) PROFILE C) PLAN D) SHOW PLAN Answer: A Explanation: EXPLAIN returns the logical and physical plan without executing the query, while PROFILE runs the query and shows runtime statistics. Question 19. In a query plan, which operator is responsible for expanding relationships from a start node? A) NodeByLabelScan B) Expand(All) C) Projection D) Filter Answer: B Explanation: Expand (or Expand(All)) traverses outgoing/incoming relationships from the current node(s). Question 20. Which traversal algorithm explores all nodes reachable within a given depth before moving deeper? A) Depth‑First Search (DFS) B) Breadth‑First Search (BFS) C) Dijkstra’s algorithm D) A* search
Answer: B Explanation: BFS visits nodes level by level, which is useful for finding shortest‑path lengths in unweighted graphs. Question 21. What does the variable‑length pattern (a)-[*1..3]->(b) match? A) Exactly three relationships between a and b. B) Between one and three relationships, any type and direction as indicated. C) Any number of relationships up to three, but only of type *. D) No relationships; it is a syntax error. Answer: B Explanation: [*1..3] denotes a path of length 1 to 3, any relationship type, following the specified direction. Question 22. Which command imports a CSV file located at /tmp/people.csv and creates Person nodes? A) LOAD CSV FROM 'file:///tmp/people.csv' AS line CREATE (:Person {name: line[0]}); B) IMPORT CSV '/tmp/people.csv' CREATE (:Person {name: line.name}); C) BULK INSERT FROM '/tmp/people.csv' INTO Person; D) COPY FROM '/tmp/people.csv' TO Person; Answer: A Explanation: LOAD CSV FROM 'file:///path' reads a CSV; AS line iterates rows, and CREATE builds nodes. Question 23. Which Neo4j tool is specifically designed for massive bulk imports of data (hundreds of millions of rows)? A) LOAD CSV B) Neo4j Desktop Import Wizard
A) admin B) publisher C) reader D) architect Answer: B Explanation: The publisher role can create, modify, and delete data but does not have privileges for security administration. Question 27. To grant the ability to create indexes on the database mydb to role graphWriter, which command is used? A) GRANT INDEX ON DATABASE mydb TO graphWriter; B) GRANT CREATE INDEX ON DATABASE mydb TO graphWriter; C) GRANT ROLE graphWriter ON DATABASE mydb; D) GRANT CREATE ON DATABASE mydb TO graphWriter; Answer: B Explanation: GRANT CREATE INDEX ON DATABASE <db> TO <role> explicitly allows index creation. Question 28. Which command stops a Neo4j database instance from the command line? A) neo4j stop B) service neo4j shutdown C) neo4j-admin stop D) systemctl stop neo4j (assuming systemd) Answer: A Explanation: The neo4j script includes a stop subcommand to gracefully shut down the server.
Question 29. In Neo4j Fabric, what is the primary purpose of a “composite database”? A) To store backups of other databases. B) To provide a unified query view across multiple underlying databases. C) To replicate data for high availability. D) To host only read‑only replicas. Answer: B Explanation: Fabric’s composite database lets a single query span several databases, aggregating results as if they were one graph. Question 30. Which file typically contains the transaction logs for recovery purposes? A) neo4j.log B) debug.log C) transaction.log (or tx.log) D) config.log Answer: C Explanation: Transaction logs record all committed changes and are used during crash recovery. Question 31. Which Cypher function returns the length (number of relationships) of a path variable p? A) size(p) B) length(p) C) count(p) D) distance(p) Answer: B Explanation: length(p) returns the number of relationships traversed in the path p.
Explanation: UNION ALL concatenates result sets and retains duplicate rows; UNION removes duplicates. Question 35. In a Cypher query, how would you alias the returned property n.name as personName? A) RETURN n.name AS personName B) RETURN n.name => personName C) RETURN n.name = personName D) RETURN n.name : personName Answer: A Explanation: The AS keyword creates an alias for the returned column. Question 36. Which of the following is true about the SET clause? A) It can only add new properties, not modify existing ones. B) It can add or replace properties and also add labels to a node. C) It deletes properties when set to null. D) It can only be used inside a MERGE clause. Answer: B Explanation: SET can assign or overwrite property values and can also add labels (SET n:Label). Question 37. Which operator in a query plan indicates that the planner will use a schema index to find starting nodes? A) NodeByLabelScan B) NodeIndexSeek C) ExpandAll
D) CacheLookup Answer: B Explanation: NodeIndexSeek (or NodeIndexSeekByRange) shows that an index is being used for fast node lookup. Question 38. What is the default uniqueness constraint behavior when attempting to create a duplicate node? A) The duplicate node is silently ignored. B) An error is thrown and the transaction aborts. C) Neo4j automatically merges the duplicate into the existing node. D) The duplicate is created but flagged as invalid. Answer: B Explanation: Violating a UNIQUE constraint raises a ConstraintViolationException, causing the transaction to roll back. Question 39. Which Cypher clause is used to optionally match a pattern that may not exist? A) OPTIONAL MATCH B) LEFT JOIN C) MATCH OPTIONAL D) TRY MATCH Answer: A Explanation: OPTIONAL MATCH returns null for missing parts of the pattern, similar to a left outer join. Question 40. In Neo4j, what does the apoc.export.csv.all procedure do? A) Exports the entire database schema to CSV.
B) It adds a new label to the schema, allowing it to be used in future node creation. C) It creates an index on the label City. D) It deletes all nodes with the label City. Answer: B Explanation: db.createLabel registers a label in the schema so that it can be referenced; it does not create nodes. Question 44. Which of the following is a valid way to create a composite index for properties firstName and lastName on label Person? A) CREATE INDEX personNameIndex FOR (p:Person) ON (p.firstName, p.lastName); B) CREATE COMPOSITE INDEX ON :Person(firstName, lastName); C) CREATE INDEX ON :Person(firstName, lastName); D) CREATE INDEX personNameIndex ON (p:Person) (p.firstName, p.lastName); Answer: A Explanation: The syntax CREATE INDEX <name> FOR (n:Label) ON (n.prop1, n.prop2) defines a composite index. Question 45. Which of the following statements best describes the purpose of the apoc.periodic.commit procedure? A) It schedules a Cypher query to run periodically based on a cron expression. B) It executes a large import query in batches, committing after each batch. C) It monitors transaction commit rates for performance tuning. D) It forces a full database checkpoint. Answer: B Explanation: apoc.periodic.commit runs a query repeatedly, committing after each iteration, which is useful for massive imports.
Question 46. Which Cypher function can be used to convert a string to an integer? A) toInteger() B) int() C) parseInt() D) asInt() Answer: A Explanation: toInteger('42') returns the integer 42; it safely returns null on conversion failure. Question 47. What does the CALL dbms.listConfig() procedure return? A) All user‑defined graph schemas. B) Current Neo4j configuration settings and their values. C) List of active database connections. D) All stored procedures available in the system. Answer: B Explanation: dbms.listConfig displays configuration parameters (e.g., memory settings, paths). Question 48. Which of the following statements about Neo4j’s query cache is true? A) It caches the raw Cypher text for faster parsing. B) It caches compiled query plans for reuse across identical queries. C) It caches the result rows of previous queries. D) It caches the entire graph in RAM. Answer: B Explanation: Neo4j stores compiled query plans in a cache so that identical queries can skip planning and go straight to execution.
Explanation: apoc.create.relationship(node1, relType, properties, node2) creates a relationship where the type and properties can be computed dynamically. Question 52. Which clause can be used to limit the number of rows returned after sorting? A) TOP B) LIMIT C) MAX D) CAP Answer: B Explanation: LIMIT n returns at most n rows from the result set. Question 53. Which of the following best describes a “self‑referencing” relationship? A) A relationship where the start and end nodes are the same node. B) A relationship that references itself recursively. C) A relationship that has a property pointing to its own ID. D) A relationship that is defined in the schema but never used. Answer: A Explanation: A self‑referencing relationship connects a node to itself (e.g., a Person who “knows” themselves). Question 54. Which of the following Cypher functions returns a map of all properties of a node n? A) properties(n) B) keys(n) C) values(n) D) map(n)
Answer: A Explanation: properties(n) returns a map containing every property name/value pair of n. Question 55. What is the purpose of the apoc.meta.schema procedure? A) To generate a visual diagram of the graph. B) To retrieve the current schema, including labels, relationship types, and property keys. C) To export the schema to a JSON file. D) To enforce schema constraints automatically. Answer: B Explanation: apoc.meta.schema inspects the database and returns a description of its structural elements. Question 56. Which of the following statements about UNWIND is correct? A) It converts a map into a list of key/value pairs. B) It expands a list into a set of rows, one per element. C) It merges two separate query results. D) It removes duplicate rows from the result set. Answer: B Explanation: UNWIND takes a collection and produces a row for each element, useful for iterating over lists. Question 57. Which of the following is NOT a valid Cypher aggregation function? A) collect() B) max() C) median() D) stdev()