MongoDB Test

1. In what language(s) is MongoDB supported?
Answers:
• Perl
• Python
• PHP
• Javascript
• All of above.
2. Authentication in MongoDB is:
Answers:
• 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
Answers:
• 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"?
Answers:
• db.posts.find({title: 'Big News Story'});
• posts.search('title': 'Big News Story');
• posts.search({'title': 'Big News Story'});
• db.posts.find(title: 'Big News Story');
5. You can write custom MapReduce functions in MongoDB using:
Answers:
• Javascript
• Python
• Json
• Java
• PHP
6. The MongoDB database is capable of:
Answers:
• Multi-table joins
• ACID-compliant transactions
• Atomic (per document) operations
• Multi-object commits with rollbacks
7. What does MongoDB's Sharding provide?
Answers:
• 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
Answers:
• asynchronous
• synchronous
9. MongoDB stores documents in structures called
Answers:
• 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?
Answers:
• 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?
Answers:
• (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:
Answers:
• JavaScript
• Ruby
• Scala
• Python
13. The maximum BSON document size is:
Answers:
• 4 megabytes
• 8 megabytes
• 12 megabytes
• 16 megabytes
14. Which of the following terms describe MongoDB?
Answers:
• Configurable cache
• Relational database
• Document-oriented DBMS
• Static schema
15. Which of the following expressions are valid JSON documents?
Answers:
• {Name: "Schoolify": url: 'www.schoolifybd.com'}
• {Name: "Schoolify", url: 'www.schoolifybd.com'}
• {Name: "Schoolify". url: 'www.schoolifybd.com'}
• {Name: "Schoolify", url: www.schoolifybd.com}
• {Name: Schoolify, url: 'www.schoolifybd.com'}
16. Instead of tables, MongoDB stores data in structures called:
Answers:
• Collections
• Maps
• Tuples
• Pages
17. Which of the following statement are true
Answers:
• 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?
Answers:
• #
• $
• @
• :
19. To perform a search on a collection, and obtain a cursor object for the results, use:
Answers:
• findAndModify()
• findOne()
• query()
• find()
20. MongoDB supports UTF-8 for strings in stored objects and queries:
Answers:
• Never
• Sometimes
• Always
21. Which method should be used to create an index on a collection, if it does not already exist?
Answers:
• checkIndex()
• ensureIndex()
• createIndex()
• reIndex()
22. Which statement of the followings could NOT drop an index?
Answers:
• 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?
Answers:
• 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:
Answers:
• 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:
Answers:
• Replica pairs
• Master/Slave
• Arbiter members
• Replica sets
26. TSV files should be expected to contain:
Answers:
• Geographic data coordinates
• Tab-separated text fields
• Document indexing for a named Collection
• Binary data logs
27. MongoDB uses GridFS to:
Answers:
• 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
Answers:
• constraints
• Group by
• views
• foreign keys
29. To atomically modify and return a single document from a collection, use:
Answers:
• aggregate()
• update()
• upsert()
• findAndModify()
30. Which of the following are considered Core MongoDB operations?
Answers:
• 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?
Answers:
• Sharding
• BSON
• Geospatial Indexing
• Replica Sets
• GridFS
32. Indexes in mongodb are NOT good for:
Answers:
• 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 ?
Answers:
• JavaScriptCore
• Rhino
• Futhark
• V8
• SpiderMonkey
34. The core database operations in MongoDB are abbreviated as:
Answers:
• BSON
• JSON
• CRUD
• MDB
35. When Storing large files in MongoDB one is encouraged to use...
Answers:
• GridFS
• None of these
• MongoFS
• BSON
36. The binary log of transactions used to recover the database after a crash is called the:
Answers:
• 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?
Answers:
• $push
• $pop
• $pull
• $addToSet
• $inc
38. Which of the following is not a stage in the aggregation pipeline
Answers:
• having
• group
• sort
• limit
39. MongoDB uses the acronym TTL to mean:
Answers:
• Temporary Table Listing
• Total Time Limit
• Time To Live
• Table Time Limit
40. Which feature of mongoDB is used for data redundancy?
Answers:
• Sharding
• BSON
• Embedded Documents
• Replica Sets
• GridFS
41. Indexing
Answers:
• 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.
Answers:
• None of above
• Replica Sets
• Replications
• Sharding
43. While replication provides data redundancy, journaling is also recommended because:
Answers:
• 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.
Answers:
• False
• True
45. MongoDB can have indexes on Array Elements?
Answers:
• 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?
Answers:
• 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?
Answers:
• All of above
• Windows
• Linux
• Mac OS X
48. MongoDB document names cannot start with the characters:
Answers:
• @ or #
• $ or .
• ^ or *
• ( or )
49. Which of the following binaries handles routing of sharded queries to the proper shard?
Answers:
• mongos
• mongod
• mongorouter
• mongo
50. An operation is said to be "idempotent" if it is proven to:
Answers:
• 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?
Answers:
• BSON
• REST
• JSON
• Protocol Buffers
52. Due to their default behavior, Capped Collections are ideal for storing:
Answers:
• 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:
Answers:
• 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:
Answers:
• 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.
Answers:
• map-reduce
• padding
• partition
• pcap
56. "write concern" allows an application to:
Answers:
• 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:
Answers:
• 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
Answers:
• 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:
Answers:
• (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
Answers:
• 0
• 3
• 2
• 1
61. The equivalent for like %keyword% on mongodb find is:
Answers:
• 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?
Answers:
• 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?
Answers:
• { foo : { $inc : -1 } }
• { $dec : { foo : 1 } }
• { $inc : { foo : -1 } }
• { foo : { $dec : 1 } }
64. How many data types are available in MongoDB?
Answers:
• 6
• 2
• 4
• 8
65. Which of the following statements are true about the MongoDB Write Consistency model
Answers:
• 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
Answers:
• 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?
Answers:
• 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?
Answers:
• 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?
Answers:
• GPS
• WGS84
• LVM
• TSV
70. What is the easiest way to do tasks like totaling or averaging field values in MongoDB newer versions?
Answers:
• 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?
Answers:
• Regular expression
• Hash table
• Double
• ObjectId
72. A property used to address servers based on their real-world locations is called:
Answers:
• Data-center awareness
• GeoIP
• Cluster tagging
• Sharding
73. You cannot use characters among /\. "*<>:|?  in database names, in release version
Answers:
• <=2.2
• >=1.8
• <=2.0
• >=2.2
• >=2.0
74. MongoDB queries return a limited size (or "threshold") of results by default, usually:
Answers:
• 4096
• 512
• 256
• 101
75. What is the minimum number of mongod instances that may make up a replica set?
Answers:
• 4
• 2
• 1
• 3
76. Suppose you have a collection foo with an index created using the statement db.foo.ensureIndex({a:1, b:-1, c:1}). Which of the following queries could use the index
Answers:
• db.foo.find({a:1, b:1})
• db.foo.find({b:1})
• db.foo.find({c:1})
• db.foo.find({c:1, b:1})
77. Haystack Indexes are typically used to:
Answers:
• 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.
Answers:
• 12,000
• 65,536
• 32,768
• Unlimited
• 24,000

No comments:

Post a Comment