DATA BASE QUESIONS
Database Quiz: 100 Questions with Answers
This comprehensive quiz covers a wide range of database concepts, including relational models,
SQL, normalization, NoSQL, and more. Questions are grouped by topic for easier navigation.
Each question is multiple-choice with the correct answer and a brief explanation provided
immediately after.
Section 1: Database Fundamentals (Questions 1-20)
1. What does DBMS stand for?
A) Data Binary Management System B) Database Management System C) Data Backup
Management System D) Database Manipulation System
Answer: B) A DBMS is software that manages databases, allowing users to create, update, and
query data while ensuring data integrity.
2. Which of the following is NOT a type of database?
A) Relational B) Hierarchical C) Network D) Sequential
Answer: D) Sequential is a storage method, not a database type. The main types are
relational, hierarchical, and network databases.
3. What is the primary function of a database?
A) To store files B) To organize and manage data C) To create reports D) To process
transactions
Answer: B) A database's primary purpose is to organize and manage data efficiently for
storage, retrieval, and manipulation.
4. Which model uses tables to represent data?
A) Hierarchical B) Network C) Relational D) Object-oriented
Answer: C) The relational model uses tables (relations) with rows and columns to represent
data.
5. What is data independence in databases?
A) Ability to change data without affecting applications B) Storing data without constraints C)
Running multiple databases independently D) Backing up data separately
Answer: A) Data independence allows changes to the physical or logical structure without
affecting applications.
DATA BASE QUESIONS
6. Which component handles concurrent access in DBMS?
A) Query Processor B) Transaction Manager C) Storage Manager D) Buffer Manager
Answer: B) The Transaction Manager coordinates concurrent access to ensure data
consistency.
7. What is a schema in databases?
A) Physical storage structure B) Logical view of the database C) Query language D) Data
encryption method
Answer: B) A schema defines the logical structure and organization of the database.
8. Which level describes how data is stored on disk?
A) Conceptual B) External C) Internal D) Logical
Answer: C) The internal level describes the physical storage details.
9. What is the ANSI/SPARC three-schema architecture?
A) Physical, Logical, View B) Internal, Conceptual, External C) Storage, Query, Transaction D)
Data, Index, Constraint
Answer: B) It separates Internal (physical), Conceptual (logical), and External (view) levels.
10. Which is a disadvantage of DBMS?
A) Data redundancy B) High cost C) Poor security D) Limited scalability
Answer: B) DBMS systems can be expensive to implement and maintain.
11. What is a relation in relational databases?
A) A column in a table B) A table with rows and columns C) A foreign key constraint D) An
index structure
Answer: B) A relation is a table consisting of rows (tuples) and columns (attributes).
12. What does ACID stand for in transactions?
A) Atomicity, Consistency, Isolation, Durability B) Accuracy, Completeness, Integrity, Durability
C) Atomicity, Consistency, Independence, Durability D) Availability, Consistency, Isolation,
Durability
Answer: A) ACID properties ensure reliable transaction processing.
13. Which is NOT an ACID property?
DATA BASE QUESIONS
A) Atomicity B) Consistency C) Redundancy D) Durability
Answer: C) Redundancy is not an ACID property; it's a data storage concern.
14. What is a tuple in relational databases?
A) A column name B) A row in a table C) A database constraint D) An index key
Answer: B) A tuple represents a single row or record in a table.
15. What is cardinality in the relational model?
A) Number of attributes B) Number of tables C) Number of tuples D) Number of constraints
Answer: C) Cardinality refers to the number of rows (tuples) in a relation.
16. Which constraint ensures data integrity?
A) Primary Key B) Foreign Key C) Check C onstraint D) All of the above
Answer: D) All these constraints help maintain data integrity.
17. What is referential integrity?
A) Ensuring no null values B) Maintaining valid relationships between tables C) Preventing
duplicate records D) Encrypting sensitive data
Answer: B) It ensures foreign key values match primary key values in referenced tables.
18. Which is a distributed database characteristic?
A) Data stored on single machine B) Data spread across multiple location s C) No network
connectivity required D) Single user access only
Answer: B) Distributed databases store data across multiple physical locations.
19. What is a deadlock in DBMS?
A) Two transactions waiting for each other B) Database crash C) Slow query execution D)
Memory overflow
Answer: A) A deadlock occurs when transactions are stuck waiting for resources held by each
other.
20. Which recovery technique uses transaction logs?
A) Checkpointing B) Rollback C) Rollforward D) All of the above
Answer: D) All these techniques use transaction logs for recovery.
DATA BASE QUESIONS
Section 2: SQL Basics (Questions 21-40)
21. Which SQL command retrieves data?
A) INSERT B) UPDATE C) SELECT D) DELETE
Answer: C) SELECT is used to query and retrieve data from tables.
22. Which command adds new records?
A) ADD B) INSERT C) CREATE D) ALTER
Answer: B) INSERT adds new rows to a table.
23. What does ORDER BY do in SQL?
A) Filters rows B) Sorts results C) Groups data D) Joins tables
Answer: B) ORDER BY sorts the result set by specified columns.
24. Which clause filters grouped data?
A) WHERE B) HAVING C) GROUP BY D) ORDER BY
Answer: B) HAVING filters groups created by GROUP BY.
25. What is the wildcard for any characters in SQL?
A) * B) % C) _ D) ?
Answer: B) % matches zero or more characters in LIKE patterns.
26. Which function counts rows?
A) SUM() B) COUNT() C) AVG() D) MAX()
Answer: B) COUNT() returns the number of rows in a result set.
27. What does INNER JOIN return?
A) All matching rows from both tables B) All rows from left table C) All rows from both tables
D) Only non-matching rows
Answer: A) INNER JOIN returns only matching rows from both tables.
28. Which SQL statement creates a table?
A) CREATE TABLE B) ADD TABLE C) NEW TABLE D) MAKE TABLE
Answer: A) CREATE TABLE defines a new table structure.
DATA BASE QUESIONS
29. What does DISTINCT do?
A) Removes duplicates B) Orders data C) Groups data D) Filters nulls
Answer: A) DISTINCT eliminates duplicate rows from results.
30. Which is used for full outer join equivalent in SQL?
A) UNION B) LEFT JOIN + RIGHT JOIN C) CROSS JOIN D) INNER JOIN
Answer: B) Combining LEFT and RIGHT JOIN with UNION simulates FULL OUTER JOIN.
31. What is a subquery?
A) A query within another query B) A query with multiple tables C) A stored procedure D) A
view definition
Answer: A) A subquery is a nested SELECT statement within another query.
32. Which aggregate function ignores NULLs?
A) COUNT(*) B) COUNT(column) C) SUM() D) Both B and C
Answer: D) Both COUNT(column) and SUM() ignore NULL values.
33. What does GROUP BY do?
A) Sorts data B) Divides rows into groups C) Filters groups D) Joins tables
Answer: B) GROUP BY groups rows with the same values in specified columns.
34. Which command modifies table structure?
A) MODIFY B) ALTER TABLE C) CHANGE D) UPDATE
Answer: B) ALTER TABLE modifies existing table definitions.
35. What is a correlated subquery?
A) Independent nested query B) Query referencing outer query columns C) Query with
multiple conditions D) Query using EXISTS
Answer: B) Correlated subqueries depend on the outer query for execution.
36. Which clause limits result rows?
A) TOP B) LIMIT C) FETCH D) All of the above
Answer: D) Different databases use TOP (SQL Server), LIMIT (MySQL), or FETCH (Oracle).
37. What does COALESCE do?
DATA BASE QUESIONS
A) Concatenates strings B) Returns first non-NULL value C) Converts data types D) Counts
nulls
Answer: B) COALESCE returns the first non-NULL value from a list.
38. Which is used for string concatenation?
A) + B) || C) CONCAT() D) All of the above
Answer: D) Different databases use different concatenation operators/functions.
39. What does EXISTS check?
A) For NULL values B) If subquery returns rows C) For duplicate records D) For data type
match
Answer: B) EXISTS returns TRUE if the subquery returns any rows.
40. Which command drops a table?
A) DROP TABLE B) DELETE TABLE C) REMOVE TABLE D) TRUNCATE TABLE
Answer: A) DROP TABLE removes the table structure and data.
Section 3: Normalization and Design (Questions 41-60)
41. What is normalization?
A) Adding redundancy B) Reducing data redundancy C) Encrypting data D) Indexing data
Answer: B) Normalization eliminates redundant data and dependency issues.
42. Which normal form eliminates partial dependencies?
A) 1NF B) 2NF C) 3NF D) BCNF
Answer: B) Second Normal Form (2NF) removes partial dependencies on composite keys.
43. What is First Normal Form (1NF)?
A) No repeating groups B) Full functional dependency C) No transitive dependencies D) All
attributes are keys
Answer: A) 1NF requires atomic values and no repeating groups.
44. Which normal form deals with transitive dependencies?
A) 1NF B) 2NF C) 3NF D) 4NF
Answer: C) Third Normal Form (3NF) eliminates transitive dependencies.
DATA BASE QUESIONS
45. What is a candidate key?
A) Primary key only B) Any key that uniquely identifies a tuple C) Foreign key D) Composite
key
Answer: B) A candidate key is any attribute set that uniquely identifies a row.
46. Which is true about Boyce-Codd Normal Form (BCNF)?
A) Stricter than 3NF B) Allows some transitive dependencies C) Requires composite keys only
D) Same as 3NF
Answer: A) BCNF is a stricter version of 3NF for certain dependency scenarios.
47. What is denormalization?
A) Increasing redundancy for performance B) Further normalization C) Removing all keys D)
Adding constraints
Answer: A) Denormalization intentionally adds redundancy to improve read performance.
48. Which normal form addresses multivalued dependencies?
A) 3NF B) BCNF C) 4NF D) 5NF
Answer: C) Fourth Normal Form (4NF) eliminates multivalued dependencies.
49. What is a superkey?
A) Minimal candidate key B) Any set containing a candidate key C) Primary key only D)
Foreign key reference
Answer: B) A superkey is any set of attributes that includes a candidate key.
50. Which is NOT a normal form?
A) 1NF B) 2NF C) 6NF D) 0NF
Answer: C) 6NF is not a standard normal form; 5NF is the highest typically used.
51. What does functional dependency mean?
A) One attribute determines another B) Multiple attributes determine one C) Attributes are
independent D) Data type dependency
Answer: A) A → B means attribute A functionally determines B.
52. Which normal form requires a primary key?
DATA BASE QUESIONS
A) 0NF B) 1NF C) 2NF D) All of the above
Answer: B) 1NF requires each table to have a primary key.
53. What is an anomaly in database design?
A) Data inconsi stency issue B) Performance bottleneck C) Security vulnerability D) Index
corruption
Answer: A) Anomalies are problems like insertion, update, or deletion inconsistencies.
54. Which normal form eliminates all insertion anomalies?
A) 1NF B) 2NF C) 3NF D) BCNF
Answer: C) 3NF typically eliminates most insertion, update, and deletion anomalies.
55. What is a partial dependency?
A) Dependency on part of a composite key B) Transitive dependency C) Multivalued
dependency D) Full dependency
Answer: A) Partial dependency occurs when non-key attributes depend on part of a
composite key.
56. Which is true about normalization trade-offs?
A) Always improves performance B) Can increase query complexity C) Eliminates all
redundancy D) Requires no planning
Answer: B) Normalization can make queries more complex due to joins.
57. What is a determinant in functional dependency?
A) Dependent attribute B) Determining attribute C) Composite key D) Foreign key
Answer: B) The determinant is the attribute on the left side of a functional dependency.
58. Which normal form is most commonly used in practice?
A) 1NF B) 2NF C) 3NF D) 4NF
Answer: C) 3NF provides a good balance between normalization and performance.
59. What is a transitive dependency?
A) Direct dependency on key B) Dependency through another non-key attribute C)
Multivalued dependency D) Partial dependency
DATA BASE QUESIONS
Answer: B) A → B → C creates a transitive dependency A → C.
60. Which tool helps identify normalization issues?
A) ER Diagram B) Dependency diagram C) Data flow diagram D) Use case diagram
Answer: B) Dependency diagrams visualize functional dependencies for normalization
analysis.
Section 4: Advanced SQL and Queries (Questions 61-75)
61. What does a self-join do?
A) Joins a table with itself B) Creates recursive queries C) Joins multiple databases D) Joins
views only
Answer: A) Self-join treats a table as two separate instances for comparison.
62. Which window function calculates running total?
A) ROW NUMBER() B) SUM() OVER() C) RANK() D) LAG()
Answer: B) SUM() OVER() with ORDER BY creates running totals.
63. What is a Common Table Expression (CTE)?
A) Temporary view definition B) Stored procedure C) Trigger D) Index
Answer: A) CTE provides a temporary result set within a query.
64. Which function gets previous row value?
A) LEAD() B) LAG() C) FIRST_VALUE() D) NTH_VALUE()
Answer: B) LAG() retrieves data from the previous row in the result set.
65. What does PIVOT do?
A) Rotates rows to columns B) Joins tables C) Groups data D) Filters results
Answer: A) PIVOT transforms row values into column headers.
66. Which is used for recursive queries?
A) WITH clause B) UNION ALL C) Both A and B D) CROSS JOIN
Answer: C) Recursive CTEs use WITH and UNION ALL for hierarchical data.
67. What does CASE statement do?
A) Conditional logic in queries B) Error handling C) Transaction control D) Data validation
DATA BASE QUESIONS
Answer: A) CASE provides if-then-else logic in SQL statements.
68. Which function returns row position?
A) ROW_NUMBER() B) RANK() C) DENSE_RANK() D) All of the above
Answer: D) All these functions assign positions to rows with different tie-breaking rules.
69. What is an analytic function?
A) Aggregate function B) Window function C) Scalar function D) Table function
Answer: B) Analytic functions perform calculations across row sets without grouping.
70. Which clause specifies window frame?
A) PARTITION BY B) ORDER BY C) ROWS/RANGE D) All of the above
Answer: D) These clauses define the window for analytic functions.
71. What does FULL OUTER JOIN return?
A) All rows from both tables B) Matching rows only C) Left table rows only D) Right table rows
only
Answer: A) FULL OUTER JOIN returns all rows with NULLs where no match exists.
72. Which is used for conditional aggregation?
A) CASE with aggregate functions B) HAVING clause C) WHERE clause D) GROUP BY
Answer: A) CASE inside aggregate functions enables conditional aggregation.
73. What is a lateral join?
A) Cross join variant B) Join with table-valued functions C) Self-join type D) Anti-join
Answer: B) LATERAL allows table-valued functions in FROM clause.
74. Which function handles NULL replacement?
A) ISNULL() B) COALESCE() C) NULLIF() D) All of the above
Answer: D) All these functions handle NULL values differently.
75. What does CROSS APPLY do?
A) Cartesian product B) Correlated subquery as join C) Recursive join D) Anti-join
Answer: B) CROSS APPLY treats correlated subqueries like table joins.
DATA BASE QUESIONS
Section 5: NoSQL and Modern Databases (Questions 76-85)
76. Which is a NoSQL database type?
A) Document B) Key-value C) Column-family D) All of the above
Answer: D) NoSQL includes document, key-value, column-family, and graph databases.
77. What is a characteristic of NoSQL?
A) Fixed schema B) ACID compliance only C) Schema flexibility D) SQL-only queries
Answer: C) NoSQL databases offer schema-on-read flexibility.
78. Which NoSQL type stores JSON-like documents?
A) Key-value B) Document C) Column-family D) Graph
Answer: B) Document databases store semi-structured data as documents.
79. What is eventual consistency?
A) Immediate consistency B) Consistency achieved over time C) Strong consistency model
D) ACID transaction model
Answer: B) Eventual consistency guarantees consistency after sufficient updates.
80. Which database uses MapReduce for queries?
A) MongoDB B) Cassandra C) Redis D) Neo4j
Answer: B) Cassandra uses MapReduce-like patterns for distributed queries.
81. What is CAP theorem?
A) Consistency, Availability, Partition tolerance B) Cost, Access, Performance C) Cache,
Application, Partition D) Connection, Authentication, Performance
Answer: A) CAP theorem states you can have at most two of three properties.
82. Which NoSQL prioritizes write scalability?
A) Document stores B) Key-value stores C) Graph databases D) Column-family stores
Answer: B) Key-value stores excel at high write throughput.
83. What is sharding in NoSQL?
A) Data replication B) Horizontal partitioning C) Vertical partitioning D) Caching strategy
DATA BASE QUESIONS
Answer: B) Sharding distributes data across multiple servers horizontally.
84. Which NoSQL type excels at relationships?A) Document B) Key-value C) Graph D) Column-
family
Answer: C) Graph databases are optimized for complex relationships and traversals.
85. What is BASE in NoSQL?
A) Basically Available, Soft state, Eventual consistency B) Binary Access, Secure Exchange C)
Backup, Archive, Storage, Export D) Batch, Async, Sequential, Eventual
Answer: A) BASE is the NoSQL alternative to ACID properties.
Section 6: Database Administration and Performance (Questions 86-100)
86. What is an index in databases?
A) Data sorting structure B) Data access optimization structure C) Backup mechanism D)
Security constraint
Answer: B) Indexes speed up data retrieval at the cost of storage and write performance.
87. Which index type allows range queries?
A) Hash index B) B-tree index C) Bitmap index D) Full-text index
Answer: B) B-tree indexes support range queries and sorting.
88. What is database tuning?A) Hardware optimization B) Query and structure optimization C)
Backup scheduling D) User management
Answer: B) Database tuning optimizes queries, indexes, and structure for performance.
89. Which provides point-in-time recovery?
A) Full backup B) Transaction log backup C) Differential backup D) Incremental backup
Answer: B) Transaction logs enable recovery to any point in time.
90. What is a deadlock detection method?
A) Wait-for graph B) Query timeout C) Lock timeout
D) All of the above
Answer: D) Multiple techniques detect and resolve deadlocks.
91. Which measures database performance?
DATA BASE QUESIONS
A) Throughput B) Response time C) Concurrency D) All of the above
Answer: D) All these metrics assess different performance aspects.
92. What is query optimization?
A) Writing efficient SQL B) DBMS choosing execution plan C) Indexing all columns D) Both A
and B
Answer: D) Query optimization involves both writing good SQL and DBMS plan selection.
93. Which is a database security feature?
A) Role-based access control B) Encryption C) Auditing D) All of the above
Answer: D) Comprehensive security includes access control, encryption, and auditing.
94. What does EXPLAIN do in SQL?
A) Shows query execution plan B) Explains query syntax C) Documents query purpose D)
Translates query language
Answer: A) EXPLAIN reveals how the DBMS will execute a query.
95. Which backup strategy minimizes downtime?
A) Cold backup B) Hot backup C) Warm backup D) Incremental backup
Answer: B) Hot backups allow continuous operation during backup.
96. What is a clustered index?
A) Index storing data in index order B) Multiple indexes on one table C) Non-unique index D)
Temporary index
Answer: A) Clustered indexes determine physical data storage order.
97. Which handles database replication?
A) Primary-replica architecture B) Sharding C) Partitioning D) Clustering
Answer: A) Primary-replica provides data redundancy and load balancing.
98. What is a stored procedure advantage?
A) Pre-compiled execution B) Reduced network traffic C) Enhanced security D) All of the
above
Answer: D) Stored procedures offer multiple performance and security benefits.
DATA BASE QUESIONS
99. Which monitors database health?
A) Performance counters B) Alert systems C) Log analysis D) All of the above
Answer: D) Comprehensive monitoring uses multiple techniques.
100. What is database partitioning?
A) Splitting tables across storage B) Dividing queries C) Separating users D) Isolating
transactions
Answer: A) Partitioning divides large tables into manageable pieces for performance.