C100DEV

Review 98 C100DEV practice questions with answer explanations and community insights.

Question 1

What is the best practice for connecting to a MongoDB cluster with the Java Driver?

  1. A single, cached MongoClient instance
  2. A new MongoClient instance for each logical transaction
  3. A new MongoClient instance for each request
  4. A pool of MongoClient instances to allow multiple concurrent database requests

Question 2

A collection coll has the following documents:{_id: 4, type: “A”, value: 60}{_id: 5, type: “B”, value: 80}{_id: 6, type: “A”, value: 30}A collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}After executing the following aggregation pipeline:db.coll.aggregate([{ $match: { type: “A” }},{ $out: ‘results’} ])What is the result?

  1. Collection results has the following documents:{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  2. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  3. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  4. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}{_id: 4, type: “A”, value: 60}{_id: 5, type: “B”, value: 80}{_id: 6, type: “A”, value: 30}

Question 3

In an employee collection, each document represents an employee of the company.What data model is the most effective for tracking the relationship between an employee and their manager?

  1. Reference array to employee documents in each manager document
  2. Embed manager document into each employee document
  3. Embed employee documents as an array into each manager document
  4. Reference to manager document in each employee document

Question 4

Given the following query:db.coll.find({}).sort({“timestamp”: -1, “status”: 1})Which two indexes will most improve the performance of this query? (Choose two.)

  1. {“timestamp”: -1, “status”: -1}
  2. {“timestamp”: 1, “status”: -1}
  3. {“timestamp”: -1, “status”: 1}
  4. {“timestamp”: 1, “status”: 1}

Question 5

What Java code is a valid aggregation projection that can be used with collection.aggregate(pipeline)?

We are moving to a new platform

CertificationTest is being migrated. Some pages may be slow or briefly unavailable; everything will be back to normal within a few hours. If you run into any issue, email support@certificationtest.net.