




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Aimed at developers, this exam measures competency in MongoDB development workflows such as CRUD operations, schema design, indexing, aggregation pipelines, document modeling patterns, and API-level integration. Real-world scenarios challenge candidates to design efficient document schemas, implement map-reduce operations, optimize queries, and deliver application logic that leverages MongoDB’s flexible data structures.
Typology: Exams
1 / 119
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. What is the primary purpose of a label in Neo4j? A) To store numeric values B) To group nodes of the same type C) To define relationship direction D) To enforce uniqueness Answer: B Explanation: Labels categorize nodes (e.g., :Person, :Movie) so that queries can target a specific set of nodes efficiently.
Question 2. Which component of the property graph model stores key‑value pairs on both nodes and relationships? A) Indexes B) Constraints C) Properties D) Labels Answer: C Explanation: Properties are the key‑value attributes attached to nodes and relationships, enabling rich data representation.
Question 3. In a Neo4j query, what does the MERGE clause guarantee?
A) It always creates a new node or relationship. B) It matches existing patterns only; no creation occurs. C) It matches a pattern if it exists, otherwise creates it. D) It deletes matched patterns. Answer: C Explanation: MERGE is “find‑or‑create”; it ensures the pattern exists by matching first and creating only when absent.
Question 4. Which Cypher clause is used to temporarily hold intermediate results for further processing? A) RETURN B) WITH C) MATCH D) SET Answer: B Explanation: WITH passes variables to the next part of the query, allowing aggregation, ordering, or sub‑query chaining.
Question 5. What does the DETACH DELETE command do in Neo4j? A) Deletes a node only if it has no relationships.
C) It prevents the creation of any User node without an email. D) It automatically encrypts the email property. Answer: B Explanation: A uniqueness constraint guarantees that no two User nodes share the same email value, and it also creates an underlying index.
Question 8. Which Neo4j driver method is used to execute a Cypher query with parameters in Java? A) session.run(String query, Map<String,Object> params) B) session.execute(String query) C) session.query(String query, Object[] params) D) session.call(String query) Answer: A Explanation: The Java driver’s run method accepts a query string and a map of parameters for safe, parameterized execution.
Question 9. In a Neo4j cluster, which component is responsible for coordinating writes across the cluster? A) Read Replica B) Core Server (Leader)
C) Transaction Log D) Browser Interface Answer: B Explanation: The core server acting as the leader receives write transactions and replicates them to follower cores, ensuring consistency.
Question 10. What does RBAC stand for in Neo4j security? A) Remote Backup and Access Control B) Role‑Based Access Control C) Resource‑Based Authentication Cipher D) Real‑Time Audit Capability Answer: B Explanation: Role‑Based Access Control defines permissions by assigning users to roles, each granting specific privileges.
Question 11. Which MongoDB data type is used to store binary JSON values? A) JSON B) BSON C) CSV D) XML
Answer: A Explanation: $gt and $lt are the comparison operators for “greater than” and “less than” respectively.
Question 14. What does the $set update operator do in MongoDB? A) Increments a numeric field. B) Replaces the entire document. C) Adds a new field or updates an existing field with a specified value. D) Removes a field from the document. Answer: C Explanation: $set assigns the given value to a field, creating it if absent or overwriting it if present.
Question 15. Which of the following statements about MongoDB indexes is FALSE? A) A single‑field index can improve queries on that field. B) Compound indexes can cover queries on multiple fields in order. C) Multikey indexes are used for fields that contain arrays. D) Indexes automatically enforce uniqueness unless specified otherwise. Answer: D
Explanation: Indexes do not enforce uniqueness by default; a unique index must be created explicitly with the unique: true option.
Question 16. In the aggregation pipeline, which stage reshapes each document by adding, removing, or renaming fields? A) $match B) $group C) $project D) $unwind Answer: C Explanation: $project defines the output shape of documents, allowing inclusion, exclusion, and computed fields.
Question 17. What does the $lookup stage perform in a MongoDB aggregation pipeline? A) Filters documents based on a condition. B) Joins documents from another collection (left outer join). C) Sorts documents by a specified field. D) Removes duplicate documents. Answer: B
Explanation: Embedding is optimal when related data is read together, reducing the need for joins and improving performance.
Question 20. Which Cypher function returns the length (number of relationships) of a path? A) size(p) B) length(p) C) count(p) D) distance(p) Answer: B Explanation: length(p) returns the number of relationships traversed in path p.
Question 21. What does the EXPLAIN keyword do in a Neo4j query? A) Executes the query and returns results. B) Shows the execution plan without running the query. C) Optimizes the query automatically. D) Deletes the query from the cache. Answer: B Explanation: EXPLAIN generates and displays the query execution plan, helping developers understand performance without executing the query.
Question 22. Which of the following is NOT a valid Cypher clause for reading data? A) MATCH B) OPTIONAL MATCH C) CREATE D) WHERE Answer: C Explanation: CREATE is used for writing (creating nodes/relationships), not for reading data.
Question 23. In MongoDB, which option creates a case‑insensitive text index on the title field? A) { title: 1 } B) { title: "text" } with default collation C) { title: "text" } and set collation { locale: "en", strength: 2 } D) { title: "text", collation: { locale: "en", strength: 2 } } Answer: C Explanation: A text index combined with a collation that sets strength: 2 makes string comparisons case‑insensitive.
Question 26. In Neo4j, which clause can be used to remove a label from a node? A) DELETE B) REMOVE C) SET with -: syntax D) DETACH Answer: B Explanation: REMOVE n:Label removes the specified label from node n.
Question 27. Which of the following statements about Neo4j’s shortestPath() function is TRUE? A) It works with weighted relationships only. B) It returns all possible shortest paths between two nodes. C) It returns a single shortest path; if multiple exist, any one may be returned. D) It can be used only inside a CALL subquery. Answer: C Explanation: shortestPath() yields one shortest path (arbitrarily chosen) if several paths have the same minimal length.
Question 28. What does the $inc operator do in a MongoDB update? A) Sets a field to a new value.
B) Increments a numeric field by a specified amount. C) Appends a value to an array field. D) Removes a field from the document. Answer: B Explanation: $inc adds the provided amount to the existing numeric value (or creates the field with that amount if missing).
Question 29. Which command would you use to list all databases in a MongoDB server? A) show dbs B) db.listDatabases() C) list databases D) db.getAllDatabases() Answer: A Explanation: In the Mongo shell, show dbs prints the names and sizes of all databases.
Question 30. In Neo4j, what is the purpose of a “relationship type”? A) To store numeric values on relationships. B) To define the direction of a relationship only. C) To categorize relationships, enabling typed traversals.
Answer: A Explanation: $out writes the pipeline’s output documents to a specified collection, replacing its contents.
Question 33. Which MongoDB feature allows you to enforce that a field’s value must be unique across a collection? A) Validation rule B) Unique index C) Sharding key D) Partial index Answer: B Explanation: A unique index guarantees that no two documents contain the same value for the indexed field.
Question 34. In Cypher, how would you return only the names of all Person nodes sorted alphabetically? A) MATCH (p:Person) RETURN p.name ORDER BY p.name ASC B) MATCH (p:Person) RETURN p ORDER BY p.name C) MATCH (p:Person) RETURN name(p) SORT BY p D) MATCH (p:Person) RETURN p.name SORT p.name
Answer: A Explanation: RETURN p.name ORDER BY p.name ASC selects the name property and sorts it in ascending order.
Question 35. Which of the following is true about MongoDB’s “sharding” feature? A) It replicates data across multiple nodes for high availability. B) It partitions a collection across multiple servers based on a shard key. C) It automatically creates indexes on all fields. D) It stores data in relational tables. Answer: B Explanation: Sharding distributes portions of a collection across different servers using a defined shard key, enabling horizontal scaling.
Question 36. What is the effect of using SET n += {age: 30, city: "London"} in Cypher? A) It replaces all properties on node n with the new map. B) It adds or updates the specified properties while preserving existing ones. C) It removes the age and city properties from n. D) It creates a relationship between n and a new node. Answer: B
Explanation: OPTIONAL MATCH behaves like a left outer join, returning null for missing parts of the pattern.
Question 39. What does the $push update operator do in MongoDB? A) Inserts a document into a collection. B) Adds an element to the end of an array field. C) Removes the first element of an array. D) Replaces the entire array with a new one. Answer: B Explanation: $push appends a specified value to an array field, creating the array if it does not exist.
Question 40. Which of the following statements about Neo4j’s “core” and “read replica” servers is correct? A) Both can accept write transactions. B) Only core servers can accept writes; read replicas serve read‑only traffic. C) Read replicas store a subset of the graph data. D) Core servers are stateless and rely on read replicas for durability. Answer: B
Explanation: In a clustered Neo4j deployment, only core members handle writes; read replicas provide scalable read‑only access.
Question 41. In MongoDB, which command returns the execution statistics of a query without actually returning the documents? A) explain() B) profile() C) stats() D) runCommand({explain: ...}) Answer: A Explanation: Calling .explain() on a cursor provides details about the query plan and execution metrics.
Question 42. What does the $match stage do in an aggregation pipeline? A) Groups documents by a key. B) Filters documents based on a query condition. C) Projects specific fields. D) Sorts the documents. Answer: B