C100DBA

C100DBA practice questions, page 6 of 6, with answer review and explanations.

Question 26

A collection has the following documents:{_id: 1, firstName: “John”, hobbies: “likes sports, go to the movies, and bird watching “}{_id: 2, firstName: “Jane”, hobbies: “likes to ride a bike and hiking“}{_id: 3, firstName: “Alice”, hobbies: “likes to watch movies and kite flying“}A text search query follows the pattern “find all people whose hobbies are ‘movies’”.What Atlas Search index supports the requirements above?

  1. { “mappings”: {“hobbies” : “string”}}
  2. { “mappings”: {“properties”: {“hobbies” : {“type”: “string”}}}}
  3. { “mappings”: {“dynamic”: false,“fields”: {“hobbies”: {“type”: “string”}}}}
  4. { “mappings”: {“dynamic”: false,“properties”: {“hobbies”: {“type”: “string”}}}}

Question 27

What Java statement finds and returns a single document?

  1. coll.findOne(eq(“hello”, “world”));
  2. coll.findOne(“hello”, “world”);
  3. coll.find({“hello”: “world”}).first();
  4. coll.find(eq(“hello”, “world”)).first();

Question 28

The zip_entries collection contains documents with population information for cities within states.Given the following sample document from this collection:{_id: “36784”city: “THOMASVILLE”,state: “AL”,pop: 6229}What Java method can be used to return a list of states whose total population across all cities is over 2 million?

Question 29

What returns the number of documents matching a given query?

  1. db.coll.aggregate({“$countDocuments”: {“num”: {“$lt”: 5}}})
  2. db.coll.find({“num”: {“$lt”: 5}})
  3. db.coll.countDocuments({“num”: {“$lt”: 5}})
  4. db.coll.estimateDocumentCount({“num”: {“$lt”: 5}}})

Question 30

Given the following documents in a collection:{ _id: 1, n: ‘Apple’, p: 0.75, c: ‘Green’, q: 14 },{ _id: 2, n: [1,3,5,7], c: 14 },{ _id: 3, n: ‘Orange’, p: 0.85, c: ‘Orange’, q: 14 }Which two documents can successfully be added in the same collection? (Choose two.)

  1. { _id: 3, n: ‘Banana’, p: 0.85, c: ‘Yellow’, q: 14 },
  2. { _id: 5, n: [1,3,5,7], c: 14 },
  3. { _id: 1, n: ‘Apple’, p: 0.75, c: ‘Green’, q: 14 }
  4. { _id: 4, n: ‘Orange’, p: 0.85, c: ‘Orange’, q: 14 }