Do you know that? 2M+ businesses that use oDesk next

Contact Email:

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for MongoDB 2020

(78) Last updated: January 27
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:

Collapse | Expand

78 Answered Test Questions:

1. In what language(s) is MongoDB supported?


• Perl

• Python


• Javascript

• All of above.

2. Authentication in MongoDB is:


• Based on Linux user authentication.

• Available with sharding since version 1.8.

• Not needed if we use a non-standard port for mongod.

• U udp firewall between mongod and client connections.

• Off by default.

3. Which of the following statements are true about MongoDB


• MongoDB supports joins

• MongoDB does not support transactions and operations are not atomic.

• MongoDB does not support transactions but operations are atomic.

• MongoDB supports transactions

4. Which of the following is syntactically correct for searching the "posts" collection for a post with the title of "Big News Story"?


• db.posts.find({title: 'Big News Story'});

•'title': 'Big News Story');

•{'title': 'Big News Story'});

• db.posts.find(title: 'Big News Story');

5. You can write custom MapReduce functions in MongoDB using:


• Javascript

• Python

• Json

• Java


6. The MongoDB database is capable of:


• Multi-table joins

• ACID-compliant transactions

• Atomic (per document) operations

• Multi-object commits with rollbacks

7. What does MongoDB's Sharding provide?


• Scaling to one thousand nodes

• Easy addition of new machines without down time

• Automatic balancing for changes in load and data distribution

• All of these

• Automatic failover

8. This replication process is


• asynchronous

• synchronous

9. MongoDB stores documents in structures called


• ODB objects

• BSON objects

• JavaScript objects

• JSON objects

10. Which of the following would you use to query an inventory collection to get all items of type "food" with price less than $34?


• db.inventory.find({type: "food", price: {$lt: 34}})

• db.inventory.find({type: "food", price: {$lt: 34}}).explain()

• db.inventory.find({type: "food", price: {$lte: 34}})

11. How can you optimize document storage?


• (All of these)

• Specify an explicit, smaller _id value

• Use shorter field names within documents

• Embed small documents within other documents

12. The interactive "mongo" shell interface is based on:


• JavaScript

• Ruby

• Scala

• Python

13. The maximum BSON document size is:


• 4 megabytes

• 8 megabytes

• 12 megabytes

• 16 megabytes

14. Which of the following terms describe MongoDB?


• Configurable cache

• Relational database

• Document-oriented DBMS

• Static schema

15. Which of the following expressions are valid JSON documents?


• {Name: "Schoolify": url: ''}

• {Name: "Schoolify", url: ''}

• {Name: "Schoolify". url: ''}

• {Name: "Schoolify", url:}

• {Name: Schoolify, url: ''}

16. Instead of tables, MongoDB stores data in structures called:


• Collections

• Maps

• Tuples

• Pages

17. Which of the following statement are true


• You must specify and _id when inserting documents

• By default, there is no index on _id. It is best practice to add one if you expect to query based on _id.

• The _id of a document need only be unique on the shard in which the document is housed

• If you do not specify and _id when doing an insert, the driver will create one for you

18. MongoDB's query language uses operators that start with which character?


• #

• $

• @

• :

19. To perform a search on a collection, and obtain a cursor object for the results, use:


• findAndModify()

• findOne()

• query()

• find()

20. MongoDB supports UTF-8 for strings in stored objects and queries:


• Never

• Sometimes

• Always

21. Which method should be used to create an index on a collection, if it does not already exist?


• checkIndex()

• ensureIndex()

• createIndex()

• reIndex()

22. Which statement of the followings could NOT drop an index?


• db.collection.dropIndex({x: 1, y: -1})

• db.collection.dropIndexes();

• db.myCollection.reIndex()

• db.runCommand({dropIndexes:'foo', index : {y:1}})

• db.runCommand({dropIndexes:'foo', index : '*'})

23. To create an index for user_name field on user collection, which of the following is the correct syntax?


• db.user.createIndex({user_name:1});

• db.user.attachIndex({user_name:1});

• db.user.ensureIndex({user_name:1});

• db.user.saveIndex({user_name:1});

24. The map-reduce operation uses a temporary collection for data processing; The benefit of this behavior is that the operations:


• Are more accurate than they would be if performed on the live data

• Are more secure than they would be if performed on a named collection

• Do not take up any additional space in the database

• Can be performed concurrently on the same collection, without affecting the intermediate states

25. The currently preferred replication method is called:


• Replica pairs

• Master/Slave

• Arbiter members

• Replica sets

26. TSV files should be expected to contain:


• Geographic data coordinates

• Tab-separated text fields

• Document indexing for a named Collection

• Binary data logs

27. MongoDB uses GridFS to:


• Store large files, distributed as smaller pieces

• Reduce and summarize large data structures

• Index and sort extremely large sets of documents

• Prevent data loss after a crash or hard shutdown

28. The aggregation framework is most similar to which facility from the world of relational databases


• constraints

• Group by

• views

• foreign keys

29. To atomically modify and return a single document from a collection, use:


• aggregate()

• update()

• upsert()

• findAndModify()

30. Which of the following are considered Core MongoDB operations?


• Create, Read, Update, Drop

• Create, Read, Update, Delete

• Create, Select, Update, Delete

• Create, Select, Update, Drop

31. Which feature of mongoDB is used to balance load among multiple machines?


• Sharding


• Geospatial Indexing

• Replica Sets

• GridFS

32. Indexes in mongodb are NOT good for:


• Collections where the number of reads is much greater than the number of writes.

• Collections which are write-intensive

33. In MongoDB V2.4, what type of JavaScript engine is used to execute all JavaScript on Mongo shell ?


• JavaScriptCore

• Rhino

• Futhark

• V8

• SpiderMonkey

34. The core database operations in MongoDB are abbreviated as:






35. When Storing large files in MongoDB one is encouraged to use...


• GridFS

• None of these

• MongoFS


36. The binary log of transactions used to recover the database after a crash is called the:


• Master Replica

• Primary Shard

• Journal

• Ledger

37. Which of the following atomic operations would you use to add a value to an array only if it does not already exist in the array?


• $push

• $pop

• $pull

• $addToSet

• $inc

38. Which of the following is not a stage in the aggregation pipeline


• having

• group

• sort

• limit

39. MongoDB uses the acronym TTL to mean:


• Temporary Table Listing

• Total Time Limit

• Time To Live

• Table Time Limit

40. Which feature of mongoDB is used for data redundancy?


• Sharding


• Embedded Documents

• Replica Sets

• GridFS

41. Indexing


• Makes all writes faster

• Slows down writes that involve the index

• Slows down reads that involve the index

• Makes writes that involve the index faster

42. MongoDB's Replication can be in Master-Slave form or _______ form.


• None of above

• Replica Sets

• Replications

• Sharding

43. While replication provides data redundancy, journaling is also recommended because:


• It allows the use of Replica Sets in addition to Replica Pairs

• It improves write performance on the journaled database

• It improves read performance on the journaled database

• It allows faster, more reliable recovery after a crash

44. True or False? MongoDB can have foreign keys.


• False

• True

45. MongoDB can have indexes on Array Elements?


• True, MongoDB indexes the first element of the array.

• True, MongoDB indexes each element of the array.

• False

• True, MongoDB indexes the first non-empty element of the array.

46. What's the difference between `save()` and `insert()` in mongo shell?


• save() updates the document if if already exists (judges by their indexed keys); inserts if it's new.

• None of above is correct.

• save() updates the document if if already exists (judges by if they already contains `_id`); inserts if it's new.

• save() updates the document if if already exists (judges by comparing them byte by byte); inserts if it's new.

• No difference between them.

47. Which platform does MongoDB support?


• All of above

• Windows

• Linux

• Mac OS X

48. MongoDB document names cannot start with the characters:


• @ or #

• $ or .

• ^ or *

• ( or )

49. Which of the following binaries handles routing of sharded queries to the proper shard?


• mongos

• mongod

• mongorouter

• mongo

50. An operation is said to be "idempotent" if it is proven to:


• Produce varying results when run multiple times, even with the same input

• Produce consistent results over multiple runs, given the same input

• Produces results within linear time, compared to the number of inputs

• Eventually produce consistent results, if run a sufficient number of times with the same inputs

51. What do drivers use with protocol on the wire?





• Protocol Buffers

52. Due to their default behavior, Capped Collections are ideal for storing:


• Non-vital, chronological records, like logs

• Important records like user accounts or invoices

• Extremely large, unordered lists of documents

• Records that require high levels of consistency, e.g. account balances or sales figures

53. A Priority 0 or "passive" replica member:


• Cannot become a primary member

• Does not maintain a full copy of the data set

• Does not accept read operations

• Does not vote in elections during a failover

54. When a Capped Collection becomes full, and a new document is added:


• The operation fails

• The newest stored entry is overwritten by the new document

• The oldest entry is overwritten with the new document

• The collection expands, based on size_increment property, only if auto_resize is enabled

55. What is the extra space allocated to document on the disk to prevent moving a document when it grows as the result of update() operations.


• map-reduce

• padding

• partition

• pcap

56. "write concern" allows an application to:


• Create event handlers that fire in response to database writes

• Track the amount of space remaining after each database write

• Observe the success or failure of database writes

• Ensure that data storage is evenly distributed between servers

57. "read preference" affects how an application:


• Selects a replica set member to read from

• Selects a document collection for a read operation

• Sorts the results of a read operation

• Selects the index to use when searching for a document

58. All writes in MongoDB Must go the primary


• False

• False by default but can be overriden

• True

• True by default but can be overridden

59. If you have a compound index on multiple fields (a,b,c), you can use it to query on:


• (a), (b), or (c)

• Any combination of a,b,c

• (a), (a,b), or (a,b,c)

• Only (a,b,c)

60. How many collections are created when use use gridfs to store large files


• 0

• 3

• 2

• 1

61. The equivalent for like %keyword% on mongodb find is:


• db.collection.find({field:{$regex:{/keyword/},$options:"i"})

• db.collection.find({field:"/keyword/i")

62. Which of the following is the correct operation to query a document for both 'Football' and "Reading" within the interests data collected from a profile?


• db.profile.find({interests: "Football", interests: "Reading"})

• db.profile.find({$or: [{interests: "Football"}, {interests: "Reading"}]})

• db.profile.find({interests: {$all : ["Football", "Reading"] }})

• db.profile.find({interests: {$in: ["Football", "Reading"] }})

63. You want to minus one to field foo, what should you use?


• { foo : { $inc : -1 } }

• { $dec : { foo : 1 } }

• { $inc : { foo : -1 } }

• { foo : { $dec : 1 } }

64. How many data types are available in MongoDB?


• 6

• 2

• 4

• 8

65. Which of the following statements are true about the MongoDB Write Consistency model


• Strongly consistent by default, can be made eventually consistent

• Eventually consistent by default

• Depends on the value of w parameter specified in the getLastError cal.

• Always strongly consistent

66. When a replica set election takes place which types of nodes can participate


• only arbiters

• only regular nodes

• regular, hidden, and arbiters

• regular and arbiters but not hidden

67. What term is use to describe the order that a database stores documents on disk?


• write order

• oplog

• natural order

• sort order

68. In MongoDB's Geospatial Indexing, if you want to create & use index on EARTH, what is NOT TRUE?


• Creating a "2d" index first.

• Using decimal degrees in (longitude, latitude) order.

• Adding spherical : true inside geoNear query.

• Specifying in key like { lat : -50, lon : 13 }

• Indexing documents by multiple locations is possible in recent versions.

69. Which datum does MongoDB use for calculating geospatial coordinates?



• WGS84



70. What is the easiest way to do tasks like totaling or averaging field values in MongoDB newer versions?


• Use Aggregation Framework

• Use newly-implemented $avg and $total collection operations.

• Use Map-Reduce

71. Which of the following is not a BSON serialization type?


• Regular expression

• Hash table

• Double

• ObjectId

72. A property used to address servers based on their real-world locations is called:


• Data-center awareness

• GeoIP

• Cluster tagging

• Sharding

73. You cannot use characters among /\. "*<>:|?  in database names, in release version


• <=2.2

• >=1.8

• <=2.0

• >=2.2

• >=2.0

74. MongoDB queries return a limited size (or "threshold") of results by default, usually:


• 4096

• 512

• 256

• 101

75. What is the minimum number of mongod instances that may make up a replica set?


• 4

• 2

• 1

• 3

76. Suppose you have a collection foo with an index created using the statement{a:1, b:-1, c:1}). Which of the following queries could use the index


•{a:1, b:1})



•{c:1, b:1})

77. Haystack Indexes are typically used to:


• Improve the performance of spherical coordinate queries

• Provide full-text indexing and searches within large, individual documents

• Index large sets of documents for quick keyword searches

• Improve the performance of 2D geospatial queries

78. By default, MongoDB allows up to _____ collections.


• 12,000

• 65,536

• 32,768

• Unlimited

• 24,000