What is a Database Management System (DBMS)?
- A
Software for creating and managing databases
- B
Hardware for storing data
- C
A type of database
- D
A programming language
Master DBMS with 130+ curated MCQs covering fundamentals, relational model, SQL, normalization, transactions, concurrency, indexing, and more. Perfect for exams, interviews, and placements.
What is a Database Management System (DBMS)?
Software for creating and managing databases
Hardware for storing data
A type of database
A programming language
Which of the following is not a type of database model?
Hierarchical
Network
Relational
Linear
What is the role of a Database Administrator (DBA)?
Manage and maintain database systems
Write application programs
Design user interfaces
Handle network security
Which of the following is a disadvantage of DBMS?
Data redundancy
Data inconsistency
High cost and complexity
Poor security
What is data independence?
Ability to change schema without affecting applications
Ability to store data independently
Ability to access data without a network
Ability to use any database engine
Which of the following is a popular DBMS?
MySQL
Oracle
PostgreSQL
All of the above
What is a relation in the relational model?
A table with rows and columns
A relationship between two tables
A type of database
A query language
What is a tuple in the relational model?
A row in a table
A column in a table
A key
A foreign key
What is an attribute in a relational model?
A column in a table
A row in a table
A primary key
A foreign key
What is a candidate key?
A minimal set of attributes that uniquely identifies a tuple
A set of foreign keys
A key that is not unique
A key that is used for indexing
What is a foreign key?
A key that references a primary key in another table
A key that uniquely identifies a tuple
A key that is not used in any table
A key that is always numeric
What is the degree of a relation?
The number of attributes
The number of tuples
The number of constraints
The number of foreign keys
What does SQL stand for?
Structured Query Language
Simple Query Language
System Query Language
Standard Query Language
Which SQL command is used to retrieve data from a database?
SELECT
INSERT
UPDATE
DELETE
Which clause is used to filter records in SQL?
WHERE
HAVING
GROUP BY
ORDER BY
What is the difference between WHERE and HAVING?
WHERE filters rows; HAVING filters groups
WHERE filters groups; HAVING filters rows
Both are the same
HAVING is used for joins
Which SQL function is used to count the number of rows?
COUNT()
SUM()
AVG()
MAX()
Which join returns all rows from both tables?
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
What is the purpose of normalization?
To reduce data redundancy and improve data integrity
To increase data redundancy
To make queries faster
To secure the database
What is 1NF (First Normal Form)?
No multi-valued attributes and all attributes are atomic
No partial dependencies
No transitive dependencies
All tables have a primary key
What is 2NF?
1NF + no partial dependencies on composite keys
1NF + no transitive dependencies
1NF + all attributes depend on the whole key
Both A and C
What is 3NF?
2NF + no transitive dependencies
1NF + no partial dependencies
All tables are in 3NF automatically
No multi-valued dependencies
What is BCNF (Boyce-Codd Normal Form)?
A stricter version of 3NF where every determinant is a candidate key
Same as 3NF
Weaker than 3NF
Not related to normalization
What is denormalization?
Adding redundancy to improve query performance
Removing all redundancy
Splitting tables into smaller ones
Combining tables to reduce complexity
What is a transaction in DBMS?
A logical unit of work that must be executed atomically
A single query
A database backup
A user session
What are the ACID properties?
Atomicity, Consistency, Isolation, Durability
Atomicity, Concurrency, Isolation, Durability
Atomicity, Consistency, Integrity, Durability
Atomicity, Consistency, Isolation, Data
What does Atomicity mean in ACID?
Transaction is executed completely or not at all
Transaction maintains database consistency
Transaction is isolated from others
Transaction changes persist after commit
Which isolation level prevents dirty reads?
READ COMMITTED
READ UNCOMMITTED
REPEATABLE READ
SERIALIZABLE
What is a dirty read?
Reading uncommitted data from another transaction
Reading data that is corrupted
Reading data that does not exist
Reading data with no locks
What is a savepoint in SQL?
A point within a transaction to which you can roll back
A point where the transaction commits
A backup of the database
A checkpoint for recovery
What is concurrency control?
Managing simultaneous operations without conflict
Controlling the order of transactions
Ensuring serializability
All of the above
What is a lock in DBMS?
A mechanism to prevent concurrent access conflicts
A type of transaction
A database backup
A SQL function
What is a shared lock (S-lock)?
Allows multiple transactions to read but not write
Allows exclusive write access
Allows both read and write
Prevents any access
What is an exclusive lock (X-lock)?
Allows only one transaction to read and write
Allows multiple transactions to read
Allows no access
Is used for indexing
What is a deadlock?
Two or more transactions waiting for each other indefinitely
A transaction that fails
A corrupted database
A lock that cannot be released
What is two-phase locking (2PL)?
Protocol that ensures serializability by two phases: growing and shrinking
Protocol that locks all data at once
Protocol that uses no locks
Protocol that only uses shared locks
What is an index in a database?
A data structure that improves query performance
A key that uniquely identifies a row
A backup of data
A type of constraint
What is the difference between clustered and non-clustered index?
Clustered index defines physical order of data; non-clustered does not
Non-clustered defines physical order; clustered does not
Both are the same
Clustered index is for primary key only
What is a B-tree index?
A balanced tree structure used for indexing
A binary tree
A hash index
A dense index
What is a hash index?
Uses a hash function to map keys to bucket positions
Uses a tree structure
Is always clustered
Is used for range queries
What is the disadvantage of indexes?
They take extra storage and slow down updates
They speed up all queries
They are always necessary
They cannot be dropped
What is a bitmap index?
Uses bitmaps for low-cardinality columns
Uses a tree structure
Is used for high-cardinality columns
Is not used in modern DBMS
What is a data file?
A file that stores database records
A file that stores indexes
A file that stores logs
A file that stores metadata
What is a heap file organization?
Records are stored in no particular order
Records are stored in sorted order
Records are stored in a tree structure
Records are stored in hashed order
What is a sequential file organization?
Records are stored in sorted order based on a key
Records are stored randomly
Records are stored in a linked list
Records are stored in a tree
What is a file pointer?
A reference to a record's location in a file
A type of index
A primary key
A foreign key
What is record blocking?
Grouping multiple records into a single block for I/O efficiency
Locking records for concurrency
Encrypting records
Compressing records
What is data dictionary?
A repository of metadata about the database schema
A table of data
An index
A backup
What is query processing?
The process of transforming a high-level query into a low-level execution plan
The process of inserting data
The process of deleting data
The process of indexing
What is query optimization?
Choosing the most efficient execution plan
Rewriting the query
Removing redundant queries
All of the above
What is a query execution plan?
The steps the DBMS takes to execute a query
The SQL code
The result of a query
The indexes used
Which of the following is a typical join algorithm?
Nested loop join
Sort-merge join
Hash join
All of the above
What is a selectivity of a predicate?
The fraction of tuples that satisfy the predicate
The number of attributes in the predicate
The complexity of the predicate
The number of operations
What is a cost-based optimizer?
Optimizer that estimates cost of execution plans and picks the cheapest
Optimizer that uses rules only
Optimizer that doesn't use statistics
Optimizer that always picks the same plan
What is the Entity-Relationship (ER) model?
A conceptual data model for database design
A physical data model
A query language
A type of index
What is an entity in ER model?
A real-world object or concept
A relationship between objects
An attribute
A key
What is a relationship in ER model?
An association among entities
An attribute of an entity
A primary key
A foreign key
What is an attribute in ER model?
A property or characteristic of an entity
A relationship
A key
A table
What is a weak entity?
An entity that cannot be uniquely identified without a strong entity
An entity with no attributes
An entity that is dependent on another
Both A and C
What is cardinality in ER model?
The number of entities that participate in a relationship
The number of attributes in an entity
The number of keys
The number of tables
What is a schema in DBMS?
The overall structure of the database
A user of the database
A table in the database
A query
What is a superkey?
A set of attributes that uniquely identifies a tuple
A minimal candidate key
A foreign key
A composite key
Which SQL statement is used to create a table?
CREATE TABLE
ALTER TABLE
DROP TABLE
INSERT TABLE
What is a functional dependency?
A constraint between two sets of attributes
A foreign key constraint
A primary key constraint
A unique constraint
What does Isolation mean in ACID?
Transactions are executed as if they are the only one running
Transactions are atomic
Transactions are durable
Transactions are consistent
What is a timestamp ordering protocol?
Asserts serializability by ordering transactions based on timestamps
Uses locks only
Uses two-phase locking
Uses deadlock detection
What is a dense index?
An index that has an entry for every search key value
An index that has an entry for some search key values
An index that is clustered
An index that is not used
What is a log file?
A file that records all changes to the database
A file that stores the actual data
A file that stores indexes
A file that stores metadata
What is a query plan?
A sequence of operations to execute a query
The result of a query
The query itself
The indexes used
What is a specialization in ER model?
Subdividing an entity into sub-entities
Combining entities into a super-entity
Adding attributes to an entity
Removing attributes
Which of the following is a NoSQL database?
MongoDB
MySQL
Oracle
PostgreSQL
What is the union operation in relational algebra?
Combines two relations with same schema
Selects rows from a relation
Projects columns from a relation
Joins two relations
Which SQL command is used to remove a table from the database?
DROP TABLE
DELETE TABLE
REMOVE TABLE
TRUNCATE TABLE
What is 4NF?
Eliminates multi-valued dependencies
Eliminates transitive dependencies
Eliminates partial dependencies
Eliminates all anomalies
What is the two-phase commit protocol?
A protocol to ensure atomicity across distributed transactions
A locking protocol
A recovery protocol
A deadlock detection protocol
What is a deadlock prevention technique?
Wait-die
Wound-wait
Both A and B
None
What is a covering index?
An index that includes all columns needed for a query
An index that covers the table
An index that is always used
An index on a single column
What is a RAID system?
Redundant Array of Independent Disks for performance/reliability
A type of database
A query language
A backup mechanism
What is the cost of an index scan?
Depends on the number of index entries read
Depends on the number of blocks in the table
Always cheaper than full scan
Never used
What is a generalization in ER model?
Combining entities into a super-entity
Subdividing an entity
Adding attributes
Removing relationships
What is the role of the DBMS catalog (data dictionary)?
Stores metadata about the database objects
Stores actual data
Stores logs
Stores indexes
What is the Cartesian product operation?
Combines every tuple from one relation with every tuple from another
Selects tuples that satisfy a condition
Projects specific columns
Joins based on equality
Which clause is used to group rows with the same values?
GROUP BY
ORDER BY
WHERE
HAVING
What is a multi-valued dependency?
A dependency where one attribute determines a set of values
A dependency where one attribute determines one value
A functional dependency
A foreign key dependency
What is a phantom read?
A transaction sees new rows inserted by another transaction
A transaction reads uncommitted data
A transaction reads data that is later rolled back
A transaction reads data that is corrupted
What is granularity of locks?
The size of the data item being locked
The number of locks held
The type of lock
The duration of lock
What is a secondary index?
An index on a non-primary key column
An index on the primary key
An index that is clustered
An index that is not used
What is a recovery manager?
Component responsible for ensuring durability and recovery
Component for query optimization
Component for indexing
Component for concurrency
What is a full table scan?
Reading all rows of a table
Reading only some rows
Reading using an index
Reading from cache
What is an ISA relationship in ER model?
Represents inheritance (superclass-subclass)
Represents association
Represents aggregation
Represents composition
What is the difference between DBMS and RDBMS?
RDBMS is based on the relational model; DBMS may not be
DBMS is relational; RDBMS is not
Both are the same
RDBMS is older
What is the selection operation in relational algebra?
Selects rows that satisfy a condition
Selects columns
Renames attributes
Combines relations
What is the difference between DELETE and TRUNCATE?
DELETE removes rows one by one; TRUNCATE removes all rows quickly
TRUNCATE removes rows one by one; DELETE removes all rows quickly
Both are same
DELETE is faster
What is 5NF?
Decomposes to eliminate join dependencies
Eliminates transitive dependencies
Eliminates partial dependencies
Eliminates multi-valued dependencies
What is a serial schedule?
Transactions execute one after another
Transactions execute concurrently
Transactions are interleaved
Transactions are rolled back
What is a lock manager?
Subsystem that manages locks
Subsystem that manages transactions
Subsystem that manages logs
Subsystem that manages queries
What is a full-text index?
An index for text search
An index on a numeric column
An index that is clustered
An index for date columns
What is an extent?
A contiguous block of storage allocated to a table
A type of index
A backup file
A log file
What is a materialized view?
A view whose results are stored physically
A virtual view
A temporary table
A query
What is an aggregation in ER model?
Treating a relationship as an entity
Combining entities
Adding attributes
Removing attributes
What is a distributed database?
A database that is spread across multiple sites
A database with multiple tables
A database with multiple users
A database with replication
What is the rename operation in relational algebra?
Renames attributes or relations
Selects rows
Projects columns
Joins relations
What is a view in SQL?
A virtual table based on a query
A physical table
An index
A stored procedure
What is the purpose of normalization?
To reduce redundancy and avoid update anomalies
To improve query performance
To make the database smaller
To enforce security
What is the read-write set of a transaction?
The data items read and written by the transaction
The attributes of the transaction
The operations of the transaction
The locks acquired
What is optimistic concurrency control?
Transactions do not lock data; conflicts resolved at commit
Transactions lock data upfront
Transactions use two-phase locking
Transactions are serialized
What is a sparse index?
Index with entries for only some search key values
Index with entries for all search key values
Index that is always clustered
Index that is never used
What is a checkpoint in database recovery?
A point where the DBMS writes all changes to disk
A point where transactions are committed
A point where locks are released
A point where indexes are rebuilt
What is a join operation?
Combining rows from two or more tables based on a common column
Selecting rows from a single table
Projecting columns
Sorting rows
What is a composite attribute?
An attribute that can be divided into smaller sub-parts
An attribute with multiple values
A key
A foreign key
What is a database query?
A request for data from the database
A request to insert data
A request to delete data
All of the above
What is the projection operation in relational algebra?
Selects specific columns
Selects specific rows
Renames relations
Joins relations
Which SQL keyword is used to sort results?
ORDER BY
GROUP BY
HAVING
WHERE
What is an update anomaly?
Data inconsistency due to redundancy
Query returning wrong results
Transaction failure
Lost update
What is a nested transaction?
A transaction within another transaction
Two independent transactions
A long-running transaction
A distributed transaction
What is the purpose of a lock table?
To track which transactions hold which locks
To store data
To store indexes
To store logs
What is a B+ tree index?
A B-tree variant where all keys are in leaves
A binary tree
A hash index
A full-text index
What is a page in database storage?
A fixed-size block of disk storage
A page of a book
A web page
A record
What is a query rewrite?
Transforming the query into a semantically equivalent but more efficient form
Re-executing the query
Cancelling the query
Caching the result
What is a derived attribute?
An attribute that can be computed from other attributes
An attribute with multiple values
A key
A composite attribute
What is a data warehouse?
A large repository for historical data used for analysis
A real-time database
A transactional database
A backup
What is a relational algebra expression?
A query expressed using relational algebra operations
A SQL query
A query plan
A stored procedure
What is a stored procedure?
A set of SQL statements stored in the database
A view
An index
A trigger
What is a determinant in functional dependency?
The left side of the dependency
The right side of the dependency
The key
The foreign key
What is a commit?
Making transaction changes permanent
Undoing transaction changes
Starting a transaction
Checking transaction consistency
What is a deadlock detection algorithm?
Algorithm that identifies deadlocks and resolves them
Algorithm that prevents deadlocks
Algorithm that ignores deadlocks
Algorithm that avoids locking
What is the purpose of indexing?
To speed up data retrieval
To enforce uniqueness
To organize data physically
All of the above
What is a tablespace?
A logical storage unit containing tables and indexes
A physical file
A data dictionary
A log file
What is a pipeline in query execution?
Passing intermediate results from one operation to another
Writing results to disk
Parallel execution
Caching results
What is a multivalued attribute?
An attribute that can have multiple values
An attribute that has a single value
A composite attribute
A derived attribute
What is the difference between INNER JOIN and OUTER JOIN?
INNER JOIN returns matching rows; OUTER JOIN returns all rows from one table
OUTER JOIN returns matching rows; INNER JOIN returns all rows
Both are same
OUTER JOIN is faster