DBMS MCQs - Keys, SQL, Normalization and Transactions (Set 1)

DBMS MCQs - Keys, SQL, Normalization and Transactions (Set 1) - CodingHumans

Test your Database Management Systems basics: keys and constraints, SQL queries, joins, normal forms and ACID transactions. These topics appear in nearly every placement aptitude test and technical interview.

How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 16 questions.

Q1. A minimal set of attributes that uniquely identifies every row in a table is called a:

a) Super key

b) Candidate key

c) Foreign key

d) Composite attribute

Q2. A foreign key is used to:

a) Speed up every query

b) Link a table to the primary key of another table

c) Store encrypted values

d) Make a column unique

Q3. Which SQL command is a DDL command that removes all rows from a table at once while keeping the table structure?

a) DELETE

b) DROP

c) TRUNCATE

d) REMOVE

Q4. Which clause filters groups created by GROUP BY?

a) WHERE

b) HAVING

c) ORDER BY

d) LIMIT

Q5. Table Emp has 5 rows and table Dept has 4 rows. How many rows does SELECT * FROM Emp CROSS JOIN Dept return?

a) 9

b) 5

c) 4

d) 20

Q6. Which join returns all rows from the left table and only matching rows from the right table?

a) INNER JOIN

b) LEFT OUTER JOIN

c) RIGHT OUTER JOIN

d) SELF JOIN

Q7. What does SELECT COUNT(*) count compared with COUNT(column)?

a) They are always identical

b) COUNT(*) counts all rows; COUNT(column) skips rows where that column is NULL

c) COUNT(*) skips NULL rows

d) COUNT(column) counts distinct values only

Q8. A relation is in First Normal Form (1NF) if:

a) It has no partial dependencies

b) Every attribute holds atomic (indivisible) values

c) It has no transitive dependencies

d) Every determinant is a candidate key

Q9. Removing partial dependencies of non-key attributes on part of a composite key brings a relation to:

a) 1NF

b) 2NF

c) 3NF

d) 4NF

Q10. A relation is in BCNF when:

a) It is in 1NF only

b) For every non-trivial functional dependency X -> Y, X is a super key

c) It has no NULL values

d) It has exactly one candidate key

Q11. In ACID, the 'I' (Isolation) means:

a) Data is stored on an isolated disk

b) Concurrent transactions do not see each other's intermediate results

c) A transaction runs completely or not at all

d) Committed data survives crashes

Q12. Which property guarantees that once a transaction is committed its changes survive a system crash?

a) Atomicity

b) Consistency

c) Isolation

d) Durability

Q13. A dirty read happens when a transaction:

a) Reads data that another transaction has written but not yet committed

b) Reads the same row twice and gets the same value

c) Reads data from a deleted table

d) Reads an index instead of the table

Q14. Which SQL statement correctly finds the second-highest salary from table Emp(salary)?

a) SELECT MAX(salary) FROM Emp WHERE salary < (SELECT MAX(salary) FROM Emp);

b) SELECT salary FROM Emp WHERE salary = 2;

c) SELECT SECOND(salary) FROM Emp;

d) SELECT MAX(salary) - 1 FROM Emp;

Q15. Which of these is a DCL (Data Control Language) command?

a) SELECT

b) ALTER

c) GRANT

d) UPDATE

Q16. An index on a column mainly improves:

a) The speed of INSERT statements

b) The speed of searching and filtering on that column

c) Data integrity

d) Normalization

Recommended MCQs

More DBMS posts on CodingHumans

All MCQ sets

MCQ Practice hub - every subject in one place

Comments

Answered 0/0Correct 0