This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Authorization”.
1. MongoDB employs _________ to govern access to a MongoDB system.
a) RBAS
b) RBAC
c) RBCC
d) None of the mentioned
View Answer
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: The role provides the 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
Explanation: 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
Explanation: 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
Explanation: To provide user administrators, MongoDB has userAdmin and userAdminAnyDatabase roles.
8. Data of <database>.system.indexes can be accessed using ____________
a) listallIndexes
b) listIndexes
c) ViewIndexes
d) SelectIndexes
View Answer
Explanation: 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
Explanation: 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
Explanation: A value of 1 indicates success.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Practice Programming MCQs
- Check MongoDB Books
- Apply for Programming Internship
- Check Information Technology Books