0% found this document useful (0 votes)
16 views5 pages

Database MCQs

Uploaded by

epic sound
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Database MCQs

Uploaded by

epic sound
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Database MCQs

1. What is a primary key in a database?

a) A unique identifier for each record in a table

2. What is a foreign key?

a) A key used to link two tables together

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

a) Clustered index sorts data physically; non-clustered doesn't

4. What is SQL injection?

a) An attack that inserts malicious SQL statements

5. What is a stored procedure?

a) A precompiled SQL code that can be executed

6. What is normalization in databases?

a) Process of organizing data to avoid redundancy

7. Which SQL clause is used to filter the result set?

a) WHERE

8. What is the difference between DELETE and TRUNCATE?

a) DELETE removes rows one by one; TRUNCATE removes all rows at once

9. Which of the following is a NoSQL database?

a) MongoDB

10. What does ACID stand for in databases?

a) Atomicity, Consistency, Isolation, Durability


11. What is a view in SQL?

a) A virtual table based on the result of an SQL query

12. What is the purpose of indexing in a database?

a) To improve the speed of data retrieval

13. What is a composite key?

a) A key composed of two or more columns

14. What is the difference between INNER JOIN and OUTER JOIN?

a) INNER JOIN returns matching rows; OUTER JOIN returns all rows

15. Which of the following is an example of a DDL command?

a) CREATE

16. What is a transaction in a database?

a) A sequence of operations performed as a single unit

17. What is referential integrity in databases?

a) Ensures that relationships between tables remain consistent

18. What is a schema in a database?

a) The structure of a database

19. What does SQL stand for?

a) Structured Query Language

20. What is a cursor in SQL?

a) A database object used to retrieve data row by row

21. What is a trigger in SQL?


a) A SQL code that automatically executes in response to certain events

22. What is the purpose of a unique constraint in a database?

a) Ensures no duplicate values in a column

23. What is a data warehouse?

a) A large store of data accumulated from a wide range of sources

24. What is a relational database management system (RDBMS)?

a) A system that manages relational databases

25. What is an aggregate function in SQL?

a) A function that performs a calculation on a set of values

26. What is a database lock?

a) A mechanism to control access to data in a database

27. What is the purpose of a foreign key constraint?

a) To maintain relationships between tables

28. What is an ER diagram in databases?

a) A graphical representation of database entities and relationships

29. What is a materialized view?

a) A database object that stores the result of a query and updates periodically

30. What is partitioning in databases?

a) Dividing a database into smaller parts for performance

31. What is the purpose of the GROUP BY clause in SQL?

a) To group rows that have the same values


32. What is sharding in NoSQL databases?

a) Dividing a database into smaller shards for scalability

33. What is the difference between CHAR and VARCHAR data types?

a) CHAR is a fixed-length string; VARCHAR is variable-length

34. What is the purpose of the HAVING clause in SQL?

a) To filter groups based on a condition

35. What is denormalization in databases?

a) Process of merging data for performance optimization

36. What is the purpose of a subquery in SQL?

a) To embed one query inside another

37. What is a deadlock in databases?

a) A situation where two processes block each other

38. What is the difference between UNION and UNION ALL?

a) UNION removes duplicates; UNION ALL includes all records

39. What is the purpose of the DISTINCT keyword in SQL?

a) To return unique values

40. What is database replication?

a) Copying data from one database to another

41. What is the difference between a database and a data lake?

a) A database stores structured data; a data lake stores raw data

42. What is a surrogate key?


a) A unique identifier created by the database

43. What is a self-join in SQL?

a) Joining a table with itself

44. What is the purpose of the ORDER BY clause in SQL?

a) To sort the result set

45. What is the difference between OLTP and OLAP?

a) OLTP handles transactional data; OLAP handles analytical data

46. What is the difference between database mirroring and replication?

a) Mirroring is real-time duplication; replication is periodic copying

47. What is a temporary table in SQL?

a) A table created temporarily for the duration of a session

48. What is a data dictionary?

a) Metadata that describes the structure of a database

49. What is a cursor used for in a database?

a) To fetch rows one at a time

50. What is an index scan in SQL?

a) A scan of all records in an index

You might also like