Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

MongoDB MCQ Set 1

1. Indexes are typically available in ______ or located sequentially on disk.
a) RAM
b) ROM
c) CMOS
d) None of the mentioned

View Answer

Answer: a [Reason:] Querying only the index can be much faster than querying documents outside of the index.

2. Point out the wrong statement :
a) Query selectivity refers to how well the query predicate excludes or filters out documents in a collection
b) Query selectivity can determine whether or not queries can use indexes effectively or even use indexes at all
c) More selective queries match a larger percentage of documents
d) All of the mentioned

View Answer

Answer: c [Reason:] More selective queries match a smaller percentage of documents.

3. ___________ is used to determine whether a query is a covered query .
a) explainstats()
b) explain()
c) explainall()
d) all of the mentioned

View Answer

Answer: b [Reason:] db.collection.explain() provides information on the execution of other operations, such as db.collection.update().

4. The ________ message is used to update a document in a collection.
a) UPDATE
b) OP_UPDATE
c) OP_UPDATES
d) All of the mentioned

View Answer

Answer: b [Reason:] Only the OP_QUERY and OP_GET_MORE messages result in a response from the database.

5. Point out the correct statement :
a) An equality match on the unique _id field is less selective as it can match at most one document
b) The selectivity of regular expressions depends on the expressions themselves
c) Less selective queries can use indexes effectively or even at all
d) All of the mentioned

View Answer

Answer: b [Reason:] If an index exists for the field, then MongoDB matches the regular expression against the values in the index, which can be faster than a collection scan.

6. _____ can modify specific fields of an existing document or documents or replace an existing document entirely, depending on the update parameter.
a) modify()
b) update()
c) find()
d) none of the mentioned

View Answer

Answer: b [Reason:] By default, the update() method updates a single document.

7. The update() method uses the _______ command, which uses the default write concern.
a) find
b) read
c) update
d) modify

View Answer

Answer: c [Reason:] The update() method returns an object that contains the status of the operation.

8. _________ is used to view statistics about the query plan for a given query.
a) db.explain()
b) cursor.explain()
c) cursor.explainstats()
d) all of the mentioned

View Answer

Answer: b [Reason:] This information can help as you develop indexing strategies.

9. An ________ query plan has returned a threshold number of matching results
a) execution
b) unordered
c) ordered
d) none of the mentioned

View Answer

Answer: c [Reason:] An ordered query plan has returned all the matching results.

10. A query _______ consists of a combination of query, sort, and projection specifications.
a) plan
b) shape
c) stats
d) all of the mentioned

View Answer

Answer: b [Reason:] Index filters determine which indexes the optimizer evaluates for a query shape.

MongoDB MCQ Set 2

1. The auditing facility can write audit events to the console, the _________, a JSON file, or a BSON file.
a) oplog
b) syslog
c) evallog
d) none of the mentioned

View Answer

Answer: b [Reason:] MongoDB provides an option to send output to the host’s syslog system.

2. Point out the correct statement :
a) When a process writes to a resource, it takes an exclusive write lock to prevent other processes from writing to or reading from that resource
b) As clients insert new documents into the capped collection, the tailable cursor continues to retrieve documents
c) Write concern allows your application to detect insertion errors or unavailable mongod instances
d) All of the mentioned

View Answer

Answer: d [Reason:] MongoDB Enterprise includes an auditing capability for mongod and mongos instances.

3. _________ contains the local ip address and the port number of the running instance.
a) ts
b) local
c) remote
d) users

View Answer

Answer: b [Reason:] Remote document contains the remote ip address and the port number of the incoming connection associated with the event.

4. Enabling _____________ degrades performance more than logging only the authorization failures.
a) auditAuthorizationFailure
b) auditAuthorizationSuccess
c) auditAuthorizationlog
d) none of the mentioned

View Answer

Answer: b [Reason:] System Event Audit Message is available only in MongoDB Enterprise.

5. Point out the correct statement :
a) An equality match on the unique _id field is less selective as it can match at most one document
b) The selectivity of regular expressions depends on the expressions themselves
c) Less selective queries can use indexes effectively or even at all
d) All of the mentioned

View Answer

Answer: b [Reason:] If an index exists for the field, then MongoDB matches the regular expression against the values in the index, which can be faster than a collection scan.

6. Use the ____________ option to enable auditing and specify where to output the audit events.
a) –auditLocation
b) –auditOutput
c) –auditDestination
d) None of the mentioned

View Answer

Answer: c [Reason:] For sharded clusters, if you enable auditing on mongos instances, you must enable auditing on all mongod instances in the cluster, i.e. shards and config servers.

7. The audit file rotates at the same time as the ________ log file.
a) Client
b) Server
c) Application
d) All of the mentioned

View Answer

Answer: b [Reason:] Printing audit events to a file in JSON format degrades server performance more than printing to a file in BSON format.

8. To view the contents of the file, pass the file to the MongoDB utility ___________
a) bsonlog
b) bsonout
c) bsondump
d) SelectIndexes

View Answer

Answer: c [Reason:] The following converts the audit log into a human-readable form and output to the terminal: bsondump data/db/auditLog.bson .

9. The _____________ option accepts either full path name or relative path name.
a) –auditPathLog
b) –logPath
c) –auditPath
d) None of the mentioned

View Answer

Answer: c [Reason:] To enable auditing and print audit events to a file in BSON binary format, specify file for the –auditDestination setting, BSON for the –auditFormat setting, and the output filename for the –auditPath.

10. The _________ message limit can result in the truncation of the audit messages.
a) oplog
b) syslog
c) evallog
d) none of the mentioned

View Answer

Answer: b [Reason:] The auditing system will neither detect the truncation nor error upon its occurrence.

MongoDB MCQ Set 3

1. Which of the following method is used for managing user ?
a) db.createUser()
b) db.User()
c) db.superuser()
d) none of the mentioned

View Answer

Answer: a [Reason:] MongoDB provides the db.createUser() to add and manage user information.

2. Point out the correct statement :
a) Authentication is the process of verifying the identity of a client
b) When access control is enabled, MongoDB requires all clients to authenticate themselves first in order to determine the access for the client
c) Authentication and authorization are closely connected
d) All of the mentioned

View Answer

Answer: d [Reason:] Authentication is distinct from authorization.

3. MongoDB stores user information in the _________ collection.
a) system.allusers
b) system.users
c) system.superusers
d) system.usersnone

View Answer

Answer: b [Reason:] MongoDB stores all user information, including name, password, and the user’s database, in the system.users collection in the admin database.

4. Which of the follwing authentication method is used by default by MongoDB ?
a) SCRAM-SHA-1
b) LDAP
c) MONGODB-CR
d) None of the mentioned

View Answer

Answer: a [Reason:] SCRAM-SHA-1 verifies supplied user credentials against the user’s name, password and database.

5. Point out the wrong statement :
a) Authorization determines the verified user’s access to resources and operations
b) MongoDB does not support authentication mechanisms
c) To authenticate a client in MongoDB, you must add a corresponding user to MongoDB
d) None of the mentioned

View Answer

Answer: b [Reason:] In addition to verifying the identity of a client, MongoDB can require members of replica sets and sharded clusters to authenticate their membership.

6. _________ is a challenge-response mechanism that authenticates users through passwords.
a) SCRAM-SHA-1
b) LDAP
c) MONGODB-CR
d) None of the mentioned

View Answer

Answer: c [Reason:] Using key files, you can also use MONGODB-CR authentication for the internal member authentication of replica set members and sharded cluster members.

7. MongoDB supports _________ certificate authentication for use with a secure TLS/SSL connection.
a) x.590
b) x.509
c) x.950
d) All of the mentioned

View Answer

Answer: b [Reason:] To authenticate to servers, clients can use x.509 certificates instead of usernames and passwords.

8. MongoDB __________ supports authentication using a Kerberos service.
a) Standard
b) Express
c) Enterprise
d) None of the mentioned

View Answer

Answer: c [Reason:] Kerberos is an industry standard authentication protocol for large client/server systems.

9. MongoDB Enterprise supports proxy authentication through :
a) SCRAM-SHA-1
b) LDAP
c) MONGODB-CR
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB does not support LDAP authentication in mixed sharded cluster deployments that contain both version 2.4 and version 2.6 shards.

10. Every MongoDB mongod and mongos instance (or mongod.exe or mongos.exe on Windows) must have an associated :
a) service replica
b) service sets
c) service principal
d) service principle

View Answer

Answer: c [Reason:] Service principal names must be reachable over the network using the fully qualified domain name (FQDN) part of its service principal name.

MongoDB MCQ Set 4

1. MongoDB employs _________ to govern access to a MongoDB system.
a) RBAS
b) RBAC
c) RBCC
d) None of the mentioned

View Answer

Answer: b [Reason:] RBAC stands for Role-Based Access Control.

2. Point out the correct statement :
a) MongoDB provides built-in roles, each with a dedicated purpose for a common use case
b) MongoDB does not enable authorization by default
c) Administrators also can create new roles and privileges to cater to operational needs
d) All of the mentioned

View Answer

Answer: b [Reason:] You can enable authorization using the –auth or the –keyFile options, or if using a configuration file, with the security.authorization or the security.keyFile settings.

3. __________ consists of a specified resource and the actions permitted on the resource.
a) privilege
b) action
c) command
d) right

View Answer

Answer: a [Reason:] A privilege resource is either a database, collection, set of collections, or the cluster.

4. _________ provides all the privileges of the read role.
a) delete
b) update
c) readWrite
d) none of the mentioned

View Answer

Answer: c [Reason:] The role provides ability to modify data on all non-system collections and the system.js collection.

5. Point out the wrong statement :
a) When granted a role, a user receives all the privileges of that role
b) A role consists of privileges that pair resources with not allowed operations
c) User cannot have several roles in MongoDB
d) None of the mentioned

View Answer

Answer: c [Reason:] A user can have several roles concurrently, in which case the user receives the union of all the privileges of the respective roles.

6. MongoDB stores user credentials in the protected admin.system._________
a) user
b) capped
c) cappeduser
d) users

View Answer

Answer: d [Reason:] The admin.system.users collection stores the user’s authentication credentials as well as any roles assigned to the user.

7. You must have the _______ action on a database to create a new user on that database.
a) createUser
b) createSuperUser
c) createSuUser
d) all of the mentioned

View Answer

Answer: a [Reason:] To provide user administrators, MongoDB has userAdmin and userAdminAnyDatabase roles.

8. Data of .system.indexes can be accessed using :
a) listallIndexes
b) listIndexes
c) ViewIndexes
d) SelectIndexes

View Answer

Answer: b [Reason:] Kerberos is an industry standard authentication protocol for large client/server systems.

9. You must have the __________ action on a role’s database to grant the role to another user.
a) grantRole
b) grantRoleAdm
c) grantRolePrivilege
d) none of the mentioned

View Answer

Answer: a [Reason:] listIndexes returns information about the indexes on the specified collection.

10. Command listIndexes.ok returning value 1 indicates :
a) failure
b) success
c) abnormal exit
d) none of the mentioned

View Answer

Answer: b [Reason:] A value of 1 indicates success.

MongoDB MCQ Set 5

1. _________ is a binary serialization format used to store documents and make remote procedure calls in MongoDB.
a) BSON
b) GridFS
c) JSON
d) None of the mentioned

View Answer

Answer: a [Reason:] BSON supports many data types as values in documents.

2. Point out the correct statement :
a) ObjectIds are small, likely unique, fast to generate, and ordered
b) ObjectIds are large, likely unique, and ordered
c) ObjectIds values consists of 18-byte
d) All of the mentioned

View Answer

Answer: a [Reason:] In MongoDB, documents stored in a collection require a unique _id field that acts as a primary key.

3. Which of the following data type is depreciated ?
a) Double
b) String
c) Object
d) Undefined

View Answer

Answer: d [Reason:] MongoDB treats some types as equivalent for comparison purposes.

4. Each data type has a corresponding number that can be used with the _______ operator to query documents by BSON type.
a) $type
b) $server
c) $agent
d) None of the mentioned

View Answer

Answer: a [Reason:] $type selects the documents where the value of the field is an instance of the specified numeric BSON type.

5. Point out the wrong statement :
a) BSON Date is a 32-bit integer that represents the number of milliseconds
b) The BSON timestamp type is for internal MongoDB use
c) If you need to query the database for exact, mathematically valid matches, use Ambiguity Precision
d) None of the mentioned

View Answer

Answer: a [Reason:] This results in a representable date range of about 290 million years into the past and future.

6. MongoDB represents queries as ___________ objects.
a) BSON
b) JSON
c) GSON
d) None of the mentioned

View Answer

Answer: a [Reason:] As a client program assembles a query in MongoDB, it builds a BSON object, not a string.

7. There is _________ byte counter in BSON, starting with a random value
a) 2
b) 3
c) 4
d) None of the mentioned

View Answer

Answer: b [Reason:] ObjectId is a 12-byte BSON type

8. In the mongo shell, you can access the creation time of the ObjectId, using the ______ method..
a) getTime()
b) getTimestamp()
c) Timestamp()
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB clients should add an _id field with a unique ObjectId.

9. __________ returns the JavaScript representation in the form of a string literal
a) toStringJava()
b) toString()
c) String()
d) none of the mentioned

View Answer

Answer: b [Reason:] In previous versions, toString() returns the hexadecimal string representation, which as of version 2.2 can be retrieved by the str property.

10. Which of the following query is used to generate a new ObjectId, use the ObjectId() constructor with no argument
a) x = ObjectIdAdd()
b) x = addObjectId()
c) x = ObjectId()
d) none of the mentioned

View Answer

Answer: c [Reason:] ObjectId() constructor is used with no argument for new object.