SQL MCQs – Database Administration and Security

Database administration and security are crucial for managing and safeguarding organizational data. Topics include user roles, access control, backups, disaster recovery, encryption, and SQL injection prevention. Mastering these concepts ensures robust database performance, minimizes risks, and secures sensitive data. Preparing with MCQs on these topics will help you confidently handle interview questions about database management and security strategies.

1.) What is the primary role of a database administrator (DBA)?

A) Designing user interfaces
B) Managing and securing the database system
C) Writing application code
D) Developing mobile applications

Answer: Option B

Explanation: The DBA is responsible for ensuring the database is operational, secure, and efficient.

2.) Which SQL command is used to grant permissions to a user?

A) ALLOW
B) PERMIT
C) GRANT
D) ASSIGN

Answer: Option C

Explanation: The GRANT command assigns specific permissions to a user or role.

3.) What does the REVOKE command do?

A) Removes permissions from a user
B) Deletes user accounts
C) Denies access to the database
D) Creates a backup of permissions

Answer: Option A

Explanation: REVOKE removes previously granted permissions.

4.) What is the purpose of database auditing?

A) To optimize query performance
B) To track and log database activities
C) To encrypt database files
D) To design database schemas

Answer: Option B

Explanation: Database auditing helps monitor and log user activities for security and compliance.

5.) Which method helps protect against SQL injection?

A) Using stored procedures
B) Input validation
C) Parameterized queries
D) All of the above

Answer: Option D

Explanation: These methods prevent malicious input from being executed as SQL code.

6.) What is the purpose of database encryption?

A) To compress data
B) To improve performance
C) To secure data from unauthorized access
D) To create database backups

Answer: Option C

Explanation: Encryption encodes data to prevent unauthorized access, ensuring confidentiality.

7.) Which SQL command is used to create a user?

A) ADD USER
B) CREATE USER
C) NEW USER
D) INSERT USER

Answer: Option B

Explanation: CREATE USER is the standard SQL command to add a new user to the database.

8.) How can unauthorized database access be prevented?

A) By enforcing strong authentication methods
B) By implementing firewalls
C) By regularly updating security patches
D) All of the above

Answer: Option D

Explanation: A combination of these methods ensures comprehensive protection.

9.) What does the term “role-based access control” (RBAC) mean?

A) Assigning permissions to individual users
B) Granting access based on predefined roles
C) Encrypting sensitive data
D) Backing up the database

Answer: Option B

Explanation: RBAC assigns permissions to roles rather than individual users, simplifying management.

10.) Which SQL command is used to modify a user’s password?

A) ALTER USER
B) UPDATE PASSWORD
C) CHANGE PASSWORD
D) MODIFY PASSWORD

Answer: Option A

Explanation: ALTER USER allows modification of user attributes, including passwords.

Leave a Reply

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