250+ TOP MCQs on Collection-Level Access Control and Answers

MongoDB Multiple Choice Questions on “Collection-Level Access Control”.

1. Administrators can implement collection-level access control through user-defined __________
a) roles
b) replica sets
c) shards
d) none of the mentioned

Answer: a
Clarification: By creating a role with privileges that are scoped to a specific collection in a particular database, administrators can provision users with roles that grant privileges on a collection level.

2. Point out the correct statement.
a) A rule consists of actions and the resources upon which the actions are permissible
b) Document-level access control allows developers to grant users privileges that are scoped to specific record
c) Each privilege action in a role can be scoped to a different record
d) None of the mentioned

Answer: b
Clarification: Collection-level access control allows administrators to grant users privileges that are scoped to specific collections.

3. User can grant any role in the database to any user from any database in the system through _________ action.
a) grantRole
b) viewRole
c) killCursors
d) unlock

Answer: a
Clarification: Apply this action to database resources.

4. User can remove any role from any user from any database in the system through _________
a) grantRole
b) viewRole
c) killCursors
d) revokeRole

Answer: d
Clarification: User can view information about any role in the given database through viewRole.

5. Point out the wrong statement.
a) MongoDB uses the combination of the database name and the role name to uniquely define a role
b) A role consists of privileges that pair resources with not allowed operations
c) Roles grant users access to MongoDB resources
d) None of the mentioned

Answer: d
Clarification: Except for roles created in the admin database, a role can only include privileges that apply to its database and can only inherit from other roles in its database.

6. _________ terminates an operation as specified by the operation ID.
a) db.killOp()
b) db.kill()
c) db.remove()
d) none of the mentioned

Answer: a
Clarification: Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.

7. Which of the following allows the user to view the information of any user in the given database?
a) createUser
b) viewUser
c) killCursors
d) all of the mentioned

Answer: b
Clarification: To provide user administrators, MongoDB has userAdmin and userAdminAnyDatabase roles.

8. _________ deletes from a shard the orphaned documents whose shard key values fall into a single continuous range.
a) listallshards
b) cleanup
c) cleanupOrphaned
d) SelectIndexes

Answer: c
Clarification: If two contiguous ranges do not belong to the shard, the cleanupOrphaned examines both ranges for orphaned documents.

9. Which of the following flushes user information from in-memory cache?
a) grantCache
b) invalidateUserCache
c) validateUserCache
d) none of the mentioned

Answer: b
Clarification: invalidateUserCache allows you to purge the cache at any given moment, regardless of the interval set in the userCacheInvalidationIntervalSecs parameter.

10. __________ displays the cached query plans for the specified query shape.
a) CacheListPlans
b) displayCacheListPlans
c) planCacheListPlans
d) none of the mentioned

Answer: b
Clarification: The query optimizer only caches the plans for those query shapes that can have more than one viable plan.

Leave a Reply

Your email address will not be published. Required fields are marked *