AI-assisted, automatically checked• Updated August 2026

DBMS MCQs

Database Management Systems MCQs covering ER modeling, relational algebra, normal forms, and transaction ACID properties.

49 MCQs1 subtopicsComputer ScienceAll Levels
Key Concept Overview & Exam Context

Review core principles of DBMS before answering questions. These questions simulate placement technical assessments (TCS, Infosys, Amazon), university exams (CS/IT), and technical certifications.

Target Readiness
Placements & Job Interviews
Question Format
Multiple-Choice with Explanations
Explained Solutions
Written explanations

Browse by Subtopic

All TopicsNormalization

DBMS MCQ Questions

Page 1 of 1 (49 total)
Q1

What is a candidate key in a relational database?

medium
View Answer & Explanation
Correct Answer: Any minimal set of attributes that can uniquely identify a row
Explanation:
A candidate key is a minimal super key, meaning no attribute can be removed from it without losing uniqueness. A table can have more than one candidate key, and one of them is chosen as the primary key.
Q2

In a database, what does referential integrity ensure?

medium
View Answer & Explanation
Correct Answer: That a foreign key value always matches an existing primary key value in the referenced table
Explanation:
Referential integrity prevents orphaned records by requiring that any foreign key value either matches a valid primary key in the parent table or is NULL. It is usually enforced through foreign key constraints.
Q3

Which SQL statement is used to remove a table's structure along with all its data?

easy
View Answer & Explanation
Correct Answer: DROP TABLE
Explanation:
DROP TABLE deletes the entire table definition along with its data and indexes. This is different from DELETE, which only removes rows, and TRUNCATE, which removes rows but keeps the table structure.
Q4

What is the main purpose of an index in a database table?

medium
View Answer & Explanation
Correct Answer: To speed up data retrieval at the cost of some extra storage and slower writes
Explanation:
An index creates a separate data structure, often a B-tree, that lets the database find rows without scanning the entire table. This speeds up reads but adds overhead to inserts and updates since the index also needs updating.
Q5

Which isolation level allows a transaction to read data that has been modified but not yet committed by another transaction?

hard
View Answer & Explanation
Correct Answer: Read Uncommitted
Explanation:
Read Uncommitted is the weakest isolation level and permits dirty reads, where a transaction sees changes made by another transaction that has not yet committed. Higher isolation levels prevent this at the cost of concurrency.
Q6

What is a deadlock in the context of database transactions?

medium
View Answer & Explanation
Correct Answer: A situation where two or more transactions are waiting on each other to release locks, with none able to proceed
Explanation:
A deadlock occurs when transactions hold locks that the others need, forming a circular wait. Most database systems detect this automatically and resolve it by rolling back one of the transactions.
Q7

Which type of SQL join returns only the rows that have matching values in both tables?

easy
View Answer & Explanation
Correct Answer: INNER JOIN
Explanation:
An INNER JOIN combines rows from two tables only where the join condition is satisfied on both sides. Rows without a match in either table are excluded from the result.
Q8

What is denormalization typically used for?

medium
View Answer & Explanation
Correct Answer: To improve read performance by intentionally introducing redundancy
Explanation:
Denormalization trades some data redundancy for fewer joins and faster reads, which can help in reporting or read-heavy systems. It is usually applied after normalization, once performance requirements are clear.
Q9

In the context of database keys, what is a composite key?

easy
View Answer & Explanation
Correct Answer: A primary key made up of two or more columns combined
Explanation:
A composite key uses more than one column together to uniquely identify a row, which is useful when no single column is unique on its own. Each individual column in the composite key may contain duplicate values.
Q10

What does the term ACID stand for in database transactions?

easy
View Answer & Explanation
Correct Answer: Atomicity, Consistency, Isolation, Durability
Explanation:
These four properties describe the guarantees a reliable transaction system provides. Consistency means a transaction moves the database from one valid state to another, while Durability means committed changes survive a system crash.
Q11

What is a view in SQL?

medium
View Answer & Explanation
Correct Answer: A virtual table based on the result of a stored query
Explanation:
A view does not store data itself; it stores a query definition and produces results when queried, pulling live data from the underlying tables. Views are often used to simplify complex queries or restrict access to certain columns.
Q12

Which normal form deals specifically with removing transitive dependencies?

hard
View Answer & Explanation
Correct Answer: Third Normal Form (3NF)
Explanation:
A table is in 3NF if it is in 2NF and every non-key attribute depends only on the primary key, not on another non-key attribute. This removes transitive dependencies, where one non-key column depends on another non-key column.
Q13

What is the purpose of a foreign key in a relational database?

easy
View Answer & Explanation
Correct Answer: To link a column in one table to the primary key of another table
Explanation:
A foreign key creates a relationship between two tables by requiring its values to match values in the referenced table's primary key. This is the mechanism that enforces referential integrity between related tables.
Q14

What is the difference between a clustered and a non-clustered index?

hard
View Answer & Explanation
Correct Answer: A clustered index determines the physical storage order of rows, while a non-clustered index does not
Explanation:
Since a clustered index dictates how rows are physically stored on disk, a table can have only one. A non-clustered index is a separate structure that points back to the actual row location, and a table can have several of these.
Q15

What does the SQL GROUP BY clause do?

easy
View Answer & Explanation
Correct Answer: Groups rows that share values in specified columns so aggregate functions can be applied to each group
Explanation:
GROUP BY collapses rows with matching values into summary rows, which is typically paired with aggregate functions like COUNT, SUM, or AVG. Without an aggregate function, GROUP BY behaves similarly to selecting distinct values.
Q16

What is a self join used for?

medium
View Answer & Explanation
Correct Answer: Joining a table to itself to compare rows within the same table
Explanation:
A self join treats a single table as if it were two separate tables by using table aliases, which is useful for comparing rows to other rows in the same table, such as finding employees who share the same manager.
Q17

Which of the following best describes a primary key?

easy
View Answer & Explanation
Correct Answer: A column or set of columns that uniquely identifies each row and cannot contain NULL values
Explanation:
Every table can have only one primary key, and the database enforces both uniqueness and the absence of NULL on it automatically. This makes the primary key the main way to reference a specific row from other tables.
Q18

What is the purpose of the HAVING clause in SQL?

medium
View Answer & Explanation
Correct Answer: To filter groups of rows after GROUP BY has been applied, often based on aggregate results
Explanation:
WHERE filters rows before grouping, while HAVING filters the groups themselves, which is necessary when the condition involves an aggregate function like SUM or COUNT that only exists after grouping.
Q19

What is a stored procedure?

medium
View Answer & Explanation
Correct Answer: A precompiled set of SQL statements saved in the database and executed as a single unit
Explanation:
Stored procedures let developers bundle logic directly inside the database, which can reduce network round trips and centralize business logic that multiple applications need to share.
Q20

In database design, what is a many-to-many relationship typically implemented with?

medium
View Answer & Explanation
Correct Answer: A junction table containing foreign keys to both related tables
Explanation:
Relational databases cannot directly represent many-to-many relationships between two tables, so a third table is introduced that holds a foreign key pointing to each side, effectively breaking the relationship into two one-to-many links.
Q21

What is the purpose of the SQL COMMIT statement?

easy
View Answer & Explanation
Correct Answer: It permanently saves all changes made during the current transaction
Explanation:
Once COMMIT is issued, the changes made in that transaction become permanent and visible to other users. Before that point, the changes can still be undone with a rollback.
Q22

What does the term 'atomicity' guarantee in a database transaction?

medium
View Answer & Explanation
Correct Answer: That all operations in a transaction complete fully or none of them do
Explanation:
Atomicity treats a transaction as a single unbreakable unit of work. If any part of it fails, the whole transaction is rolled back so the database is never left in a half finished state.
Q23

Which SQL clause is used to arrange the rows of a result set in a specific order?

easy
View Answer & Explanation
Correct Answer: ORDER BY
Explanation:
ORDER BY sorts the output rows based on one or more columns, either ascending or descending. Without it, the order in which rows are returned is not guaranteed.
Q24

What is a surrogate key?

medium
View Answer & Explanation
Correct Answer: An artificial key with no business meaning, usually a system generated number, used to identify a row
Explanation:
Surrogate keys are often auto-incrementing integers added purely to give each row a stable identifier. They are used instead of natural keys when natural keys are too long, changeable, or complex.
Q25

What is the main requirement for a table to be in First Normal Form (1NF)?

medium
View Answer & Explanation
Correct Answer: Each column must hold atomic, indivisible values with no repeating groups
Explanation:
1NF is about eliminating multi-valued or repeating columns so that each cell contains a single value. This makes the data easier to query and update consistently.
Q26

What is the main purpose of an Entity-Relationship (ER) diagram?

easy
View Answer & Explanation
Correct Answer: To visually model the entities, attributes, and relationships in a database before implementation
Explanation:
An ER diagram is a design tool used during the planning stage of a database. It helps teams agree on what entities exist and how they relate before any tables are actually created.
Q27

What is data redundancy in a database, and why is it usually a problem?

medium
View Answer & Explanation
Correct Answer: It means the same piece of data is stored in multiple places, which can lead to inconsistencies
Explanation:
When the same fact is duplicated across rows or tables, an update in one place but not another leaves the data contradictory. Normalization is one common way to reduce this problem.
Q28

What does the SQL INSERT INTO statement do?

easy
View Answer & Explanation
Correct Answer: It adds one or more new rows of data into a table
Explanation:
INSERT INTO is used to add fresh records, either by listing explicit values or by pulling rows from another query. The columns and values must match in number and compatible type.
Q29

What is the role of a transaction log in a DBMS?

hard
View Answer & Explanation
Correct Answer: It records every change made to the database so the system can recover after a crash
Explanation:
The transaction log is written before or alongside the actual data changes, which is why the technique is often called write-ahead logging. If the system crashes, the log lets it replay or undo incomplete transactions.
Q30

What is the difference between a shared lock and an exclusive lock?

medium
View Answer & Explanation
Correct Answer: A shared lock allows multiple transactions to read the same data, while an exclusive lock allows only one transaction to read or write it
Explanation:
Shared locks are compatible with each other since reading does not change data, but an exclusive lock is needed before writing to prevent other transactions from seeing or changing the same row at the same time.
Q31

What does the SQL ROLLBACK statement do?

easy
View Answer & Explanation
Correct Answer: It undoes all changes made in the current transaction, returning the data to its previous state
Explanation:
ROLLBACK is typically used when an error occurs partway through a transaction. It reverses every statement executed since the transaction began, or since the last savepoint.
Q32

What is a cursor used for in SQL programming?

hard
View Answer & Explanation
Correct Answer: It allows a program to process the rows returned by a query one at a time
Explanation:
Cursors are handy inside stored procedures or scripts when row-by-row processing is needed, though they are generally slower than set-based operations and are used sparingly.
Q33

What is the main difference between OLTP and OLAP systems?

medium
View Answer & Explanation
Correct Answer: OLTP handles many short transactions for day to day operations, while OLAP is designed for complex analytical queries over large volumes of historical data
Explanation:
A banking system processing withdrawals is a classic OLTP example, while a data warehouse used to analyze years of sales trends is a typical OLAP use case.
Q34

What is a database schema?

easy
View Answer & Explanation
Correct Answer: The overall structure or blueprint that defines the tables, columns, and relationships within a database
Explanation:
The schema describes how data is organized, not the data itself. Two databases can share the same schema while holding completely different actual records.
Q35

What does the SQL UPDATE statement do?

easy
View Answer & Explanation
Correct Answer: It modifies existing values in one or more rows of a table
Explanation:
UPDATE is usually paired with a WHERE clause to target specific rows. Leaving out the WHERE clause would change every row in the table, which is a common and costly mistake.
Q36

What issue does Boyce-Codd Normal Form (BCNF) address that 3NF does not fully cover?

hard
View Answer & Explanation
Correct Answer: Certain anomalies caused by overlapping candidate keys with functional dependencies not covered by 3NF
Explanation:
BCNF is a slightly stricter version of 3NF. A table can satisfy 3NF and still have update anomalies in rare cases involving multiple overlapping candidate keys, which BCNF is designed to catch.
Q37

What is the main responsibility of a database administrator (DBA)?

easy
View Answer & Explanation
Correct Answer: Managing database performance, security, backups, and overall availability
Explanation:
A DBA looks after the health of the database system as a whole, including tuning queries, setting up access controls, and making sure backups actually work when needed.
Q38

What is the difference between a logical schema and a physical schema?

hard
View Answer & Explanation
Correct Answer: A logical schema describes the structure of data independent of storage details, while a physical schema describes how data is actually stored on disk
Explanation:
This separation is part of what gives databases data independence: the physical storage can change, such as switching disk formats, without forcing changes to how applications view the data logically.
Q39

What does 'data independence' mean in the context of a DBMS?

medium
View Answer & Explanation
Correct Answer: The ability to change the storage structure of data without needing to rewrite applications that use it
Explanation:
Data independence is usually split into logical and physical independence, referring to how insulated the application layer is from changes at the schema or storage level.
Q40

What is a weak entity in an Entity-Relationship model?

medium
View Answer & Explanation
Correct Answer: An entity that cannot be uniquely identified by its own attributes alone and depends on a related strong entity
Explanation:
A weak entity typically uses a partial key combined with the primary key of its owning entity to form a full identifier, such as a 'dependent' record tied to an 'employee' record.
Q41

What is the purpose of an aggregate function such as SUM or COUNT in SQL?

easy
View Answer & Explanation
Correct Answer: To perform a calculation across multiple rows and return a single summary value
Explanation:
Aggregate functions are often used together with GROUP BY to produce totals or counts for each category of data rather than for the table as a whole.
Q42

What is a materialized view in a database?

hard
View Answer & Explanation
Correct Answer: A view whose result set is physically stored and periodically refreshed, rather than recalculated on every query
Explanation:
Because the results are precomputed, reading from a materialized view is much faster than running the underlying query again, at the cost of the data being slightly out of date until the next refresh.
Q43

What is the difference between horizontal and vertical partitioning of a table?

medium
View Answer & Explanation
Correct Answer: Horizontal partitioning splits rows across separate tables, while vertical partitioning splits columns across separate tables
Explanation:
Horizontal partitioning is often used to spread a huge table by date range or region, while vertical partitioning separates rarely used columns from frequently accessed ones to improve performance.
Q44

What is the purpose of a CHECK constraint in SQL?

medium
View Answer & Explanation
Correct Answer: It restricts the values that can be entered into a column based on a specified condition
Explanation:
For example, a CHECK constraint could require that an age column only accept values greater than zero, rejecting any insert or update that violates the rule.
Q45

In database modeling, what does a many-to-one relationship typically mean?

easy
View Answer & Explanation
Correct Answer: Many rows in one table can be associated with a single row in another table
Explanation:
A common example is many orders belonging to one customer. This relationship is usually implemented with a foreign key on the 'many' side pointing back to the primary key on the 'one' side.
Q46

A relation is in 2NF if it is in 1NF and contains no:

medium
View Answer & Explanation
Correct Answer: Partial dependency
Explanation:
Second Normal Form (2NF) requires that the table is in 1NF and has no partial functional dependencies (no non-prime attribute depends on a proper subset of a composite candidate key).
Q47

Which ACID property guarantees that all operations within a transaction either succeed completely or are rolled back?

easy
View Answer & Explanation
Correct Answer: Atomicity
Explanation:
Atomicity (the "A" in ACID) ensures the all-or-nothing execution of a database transaction.
Q48

What does the "I" in the ACID properties of database transactions stand for?

easy
View Answer & Explanation
Correct Answer: Isolation
Explanation:
ACID stands for Atomicity, Consistency, Isolation, and Durability.
Q49

A relation is in Second Normal Form (2NF) if it is in 1NF and contains no:

medium
View Answer & Explanation
Correct Answer: Partial functional dependencies
Explanation:
2NF requires that all non-key attributes are fully functionally dependent on the primary key, eliminating partial dependencies.