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. NOT
B. XOR
C. OR
D. AND

Correct Answer: Option D


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 sort the result set
B. To filter rows based on a condition
C. To group the results
D. To return only unique rows in the result set

Correct Answer: Option D


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. Atomicity
B. Consistency
C. Isolation
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 consistency is maintained
C. All of the above
D. Data redundancy is minimized

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. BCNF
B. 3NF
C. 1NF
D. 2NF

Correct Answer: Option D


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 made up of multiple columns
B. A key that is always a foreign key
C. A key that references another table
D. A key that is a single column

Correct Answer: Option A


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. CURDATE()
B. GETDATE()
C. NOW()
D. All of the above depending on the DBMS

Correct Answer: Option D


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 pattern matching on strings
B. To join tables
C. To aggregate data
D. To perform arithmetic operations

Correct Answer: Option A


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. PERMIT
B. ASSIGN
C. REVOKE
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 rollback a transaction
B. To remove user permissions
C. To delete a table
D. To create a user

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. INNER JOIN
B. LEFT JOIN
C. RIGHT JOIN
D. FULL JOIN

Correct Answer: Option B


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 more than two tables
B. Joining two different tables
C. Joining tables without a common column
D. Joining a table with itself

Correct Answer: Option D


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. MIN()
B. SUM()
C. AVG()
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 removes all rows; TRUNCATE removes structure
B. No difference
C. TRUNCATE can have WHERE; DELETE cannot
D. DELETE can be rolled back; TRUNCATE cannot (in most DBMS)

Correct Answer: Option D


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. NOT NULL
B. UNIQUE
C. FOREIGN KEY
D. PRIMARY KEY

Correct Answer: Option A


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. UNIQUE
B. PRIMARY KEY
C. FOREIGN KEY
D. CHECK

Correct Answer: Option A


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 set of attributes that uniquely identifies a row
B. Both A and B
C. A key that has extra attributes beyond a candidate key
D. A key that includes the primary key

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. 3NF
B. 2NF
C. 1NF
D. BCNF

Correct Answer: Option D


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 TABLE
C. CREATE SCHEMA
D. CREATE DATABASE

Correct Answer: Option D


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 table
B. A column
C. A key
D. A row

Correct Answer: Option A


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

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