B CompE Bachelor of Computer Engineering Database Management Systems 1 — Questions and Answers
Question 1: Which normal form eliminates partial dependencies on a composite primary key?
- First Normal Form (1NF)
- Second Normal Form (2NF) (Correct answer)
- Third Normal Form (3NF)
- Boyce-Codd Normal Form (BCNF)
Correct answer: Second Normal Form (2NF)
2NF removes partial dependencies by ensuring every non-key attribute is fully functionally dependent on the entire primary key.
Question 2: What SQL clause is used to filter results after aggregation?
- WHERE
- HAVING (Correct answer)
- GROUP BY
- ORDER BY
Correct answer: HAVING
The HAVING clause filters grouped results from aggregate functions, whereas WHERE filters individual rows before grouping.
Question 3: Which type of JOIN returns all rows from both tables, with NULLs where there is no match?
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- FULL OUTER JOIN (Correct answer)
Correct answer: FULL OUTER JOIN
A FULL OUTER JOIN returns all rows from both tables, filling unmatched columns with NULL values.
Question 4: What is a foreign key in a relational database?
- A key that encrypts table data
- A primary key of another table referenced by the current table (Correct answer)
- The first column of every table
- An index used for faster lookups
Correct answer: A primary key of another table referenced by the current table
A foreign key is a column (or set of columns) in one table that references the primary key of another table to enforce referential integrity.
Question 5: Which SQL command removes all rows from a table without deleting the table structure?
- DELETE
- DROP
- TRUNCATE (Correct answer)
- REMOVE
Correct answer: TRUNCATE
TRUNCATE removes all rows from a table quickly without logging individual row deletions, while keeping the table structure intact.
Question 6: What does ACID stand for in database transactions?
- Atomicity, Consistency, Isolation, Durability (Correct answer)
- Availability, Consistency, Integrity, Durability
- Atomicity, Concurrency, Integrity, Distribution
- Availability, Concurrency, Isolation, Distribution
Correct answer: Atomicity, Consistency, Isolation, Durability
ACID stands for Atomicity, Consistency, Isolation, and Durability, four properties that guarantee reliable database transactions.
Which normal form eliminates partial dependencies on a composite primary key?