Database Management System (DBMS) MCQs

Computer

Database Management System (DBMS) MCQs

Practice DBMS MCQs covering database, data, information, DBMS, RDBMS and SQL basics with answers and explanations.

278
Total Questions

Practice Questions

Page 4 of 14
Question #61
In SQL, which operator is used to combine two conditions and returns true if both are true?
A. XOR
B. AND
C. NOT
D. OR

Correct Answer: Option B


Explanation:
The AND operator returns true only if both conditions are true.

This question belongs to: Computer Database Management System (DBMS)
Question #62
What is the purpose of the SQL DISTINCT keyword?
A. To return only unique rows in the result set
B. To filter rows based on a condition
C. To sort the result set
D. To group the results

Correct Answer: Option A


Explanation:
DISTINCT removes duplicate rows from the query result.

This question belongs to: Computer Database Management System (DBMS)
Question #63
Which of the following is a property of a transaction that ensures that the database remains in a valid state before and after the transaction?
A. Isolation
B. Consistency
C. Atomicity
D. Durability

Correct Answer: Option B


Explanation:
Consistency ensures that a transaction brings the database from one valid state to another, maintaining all defined rules and constraints.

This question belongs to: Computer Database Management System (DBMS)
Question #64
What is the main advantage of using a DBMS over a file system?
A. Data security and access control are provided
B. Data redundancy is minimized
C. All of the above
D. Data consistency is maintained

Correct Answer: Option C


Explanation:
A DBMS offers advantages like reduced redundancy, consistency, security, concurrent access, and backup/recovery compared to file systems.

This question belongs to: Computer Database Management System (DBMS)
Question #65
Which normal form addresses partial dependencies, i.e., non-prime attributes dependent on part of a composite primary key?
A. 3NF
B. 2NF
C. 1NF
D. BCNF

Correct Answer: Option B


Explanation:
Second Normal Form (2NF) eliminates partial dependencies by ensuring all non-key attributes are fully functionally dependent on the entire primary key.

This question belongs to: Computer Database Management System (DBMS)
Question #66
What is a composite key in a database?
A. A key that is always a foreign key
B. A key that references another table
C. A key that is made up of multiple columns
D. A key that is a single column

Correct Answer: Option C


Explanation:
A composite key is a primary key that consists of two or more columns to uniquely identify a row.

This question belongs to: Computer Database Management System (DBMS)
Question #67
Which SQL function returns the current date and time?
A. NOW()
B. All of the above depending on the DBMS
C. GETDATE()
D. CURDATE()

Correct Answer: Option B


Explanation:
Different DBMSs have different functions: MySQL NOW(), SQL Server GETDATE(), etc. But all return current date/time.

This question belongs to: Computer Database Management System (DBMS)
Question #68
In SQL, what is the purpose of the LIKE operator?
A. To perform arithmetic operations
B. To perform pattern matching on strings
C. To join tables
D. To aggregate data

Correct Answer: Option B


Explanation:
LIKE is used with wildcards (% and _) to search for a specified pattern in a column.

This question belongs to: Computer Database Management System (DBMS)
Question #69
Which SQL keyword is used to give users permission to access database objects?
A. REVOKE
B. PERMIT
C. ASSIGN
D. GRANT

Correct Answer: Option D


Explanation:
GRANT is a DCL command used to assign privileges to users.

This question belongs to: Computer Database Management System (DBMS)
Question #70
What is the purpose of the REVOKE command in SQL?
A. To create a user
B. To remove user permissions
C. To delete a table
D. To rollback a transaction

Correct Answer: Option B


Explanation:
REVOKE is used to take away privileges previously granted to users.

This question belongs to: Computer Database Management System (DBMS)
Question #71
Which type of join returns all rows from the left table and matching rows from the right table?
A. RIGHT JOIN
B. FULL JOIN
C. INNER JOIN
D. LEFT JOIN

Correct Answer: Option D


Explanation:
LEFT JOIN (or LEFT OUTER JOIN) returns all rows from the left table, with matching rows from the right table; NULLs appear when no match.

This question belongs to: Computer Database Management System (DBMS)
Question #72
What is a self join?
A. Joining a table with itself
B. Joining two different tables
C. Joining more than two tables
D. Joining tables without a common column

Correct Answer: Option A


Explanation:
A self join is a join where a table is joined with itself, often used to compare rows within the same table.

This question belongs to: Computer Database Management System (DBMS)
Question #73
Which SQL function is used to find the maximum value in a column?
A. SUM()
B. AVG()
C. MIN()
D. MAX()

Correct Answer: Option D


Explanation:
MAX() returns the highest value in a selected column.

This question belongs to: Computer Database Management System (DBMS)
Question #74
What is the difference between DELETE and TRUNCATE commands?
A. DELETE can be rolled back; TRUNCATE cannot (in most DBMS)
B. No difference
C. TRUNCATE can have WHERE; DELETE cannot
D. DELETE removes all rows; TRUNCATE removes structure

Correct Answer: Option A


Explanation:
DELETE is a DML command that can be rolled back and can use WHERE; TRUNCATE is a DDL command that removes all rows and cannot be rolled back (in some DBMS) and resets auto-increment counters.

This question belongs to: Computer Database Management System (DBMS)
Question #75
Which constraint ensures that a column cannot have NULL values?
A. PRIMARY KEY
B. UNIQUE
C. FOREIGN KEY
D. NOT NULL

Correct Answer: Option D


Explanation:
NOT NULL constraint enforces that a column must have a value, preventing NULL entries.

This question belongs to: Computer Database Management System (DBMS)
Question #76
Which constraint ensures that all values in a column are unique?
A. FOREIGN KEY
B. CHECK
C. UNIQUE
D. PRIMARY KEY

Correct Answer: Option C


Explanation:
UNIQUE constraint ensures that all values in a column are distinct, but allows NULL (unless combined with NOT NULL).

This question belongs to: Computer Database Management System (DBMS)
Question #77
What is a super key in a relational database?
A. A key that has extra attributes beyond a candidate key
B. Both A and B
C. A key that includes the primary key
D. A set of attributes that uniquely identifies a row

Correct Answer: Option B


Explanation:
A super key is a set of one or more attributes that uniquely identifies a row. A candidate key is a minimal super key.

This question belongs to: Computer Database Management System (DBMS)
Question #78
Which normal form requires that every determinant is a candidate key?
A. 1NF
B. 2NF
C. BCNF
D. 3NF

Correct Answer: Option C


Explanation:
Boyce-Codd Normal Form (BCNF) is a stricter version of 3NF where every determinant must be a candidate key.

This question belongs to: Computer Database Management System (DBMS)
Question #79
In SQL, which statement is used to create a new database?
A. NEW DATABASE
B. CREATE SCHEMA
C. CREATE DATABASE
D. CREATE TABLE

Correct Answer: Option C


Explanation:
CREATE DATABASE is used to create a new database in SQL.

This question belongs to: Computer Database Management System (DBMS)
Question #80
What is a relation in relational database terms?
A. A row
B. A key
C. A column
D. A table

Correct Answer: Option D


Explanation:
In the relational model, a relation is a table consisting of rows and columns.

This question belongs to: Computer Database Management System (DBMS)