50 Best Multiple Choice Questions with Answers for DBMS

Basics of Database Management Systems

A database is a well-organized collection of data that can be accessed electronically from a computer system. The Database Management System (DBMS) is software that interacts with end-users, applications, and the database itself to capture and analyze data while managing this data. The sum total of the database, the DBMS, and associated applications can be referred to as a "database system."

Problems with File Systems

  • Data redundancy and inconsistency
  • Difficulty in accessing data
  • Data isolation
  • Integrity problem
  • Atomicity problem
  • Concurrent access anomalies

Instance and Schemas

  • The collection of information stored in a database at a particular moment is called an instance of the database.
  • The overall design of the database is called the database schema.

Types of Databases

  • Commercial database
  • Multimedia database
  • Deductive database
  • Temporal database
  • Geological Information System

Characteristics of Database Management Systems

  • Provides security and removes redundancy
  • The self-describing nature of a database system
  • Insulation between programs and data abstraction
  • Supports multiple views of the data
  • Sharing of data and multi-user transaction processing
  • Database Management Software allows entities and relationships among them to form tables
  • It follows the ACID concept(Atomicity, Consistency, Isolation, and Durability)

What is a Transaction?

  • To remove the partial execution problem, we increase the level of atomicity and bundle all the instructions of a logical operation into a unit called a transaction.
  • The formal definition is: 'A transaction is a set of logically related instructions to perform a logical unit of work.'

What is a Schedule?

  • When two or more transactions are executed together or one after another, they can be bundled up into a higher unit of execution called a schedule.
  • A schedule of N transactions T1, T2, T3...TN, is an ordering of the operations of the transactions. Operations from different transactions can be interleaved in the scheduled S.
  • However, the schedule for a set of transactions must contain all the instructions of those transactions, and for each transaction T that participates in the schedule S, the operation of T in S must appear in the same order in which they occur in T.

Basics of RDBMS

  • The domain is a set of atomic values.
  • By atomic we mean that each value in the domain is indivisible as far as the formal relational model is concerned.
  • A common method of specifying a domain is to specify a data type from which the data forming the domain are drawn.
  • Table(Relation): A relation is a set of tuples/rows/entities/records.
  • Tuple: Each row of a relation/table is called a tuple.
  • Degree: The number of columns/attributes of a relation.
  • Cardinality: The number of rows/types/record of a relational instance.

Properties of RDBMS

  • Cells contain atomic values
  • Values in a column are of the same kind
  • Each row is unique
  • Each column has a unique name
  • No two tables can have the same name in a relational schema
  • The sequence of rows is insignificant
  • The sequence of columns is insignificant


There are no specific MCQs provided in the original text. Please provide MCQs for this section.

Correcting Writing and Style Errors in a Multi-Choice Question

Which of the following options is the correct full form of DDL?

  1. Data Definition Language
  2. Data Derivation Language
  3. Dynamic Data Language
  4. Detailed Data Language

The correct answer is: Data Definition Language (Option 1).


N/A - This post does not have any code to update or optimize.

Correcting Sentence Structure and Grammar

The sentence is written correctly but it lacks clarity and precise language. A native English speaker from the USA would likely express the idea as:

The property that protects data from system failure is durability.


# performing a transaction robustly

    # write transaction logic here
    # if all goes well, make changes and commit

except Exception:
    # if something goes wrong, rollback transaction to
    # eliminate any unintended changes

The above Python code block is an example of how we could perform a transaction robustly. The try-catch block ensures that if an exception occurs, the entire transaction is rolled back to prevent unintended changes or inconsistencies in the data.

Preservation of Consistency in Transaction Isolation

In a transaction, Consistency is preserved during the execution in isolation. It means that the system ensures that the transaction follows all the rules and constraints of the database. The consistency of data is maintained before and after the transaction.

Atomicity: It ensures that the transaction is treated as a single unit and executed completely or not at all.

Isolation: It ensures that multiple transactions can run simultaneously without affecting each other.

Durability: It ensures that once a transaction has been committed, it will persist even in the event of a system failure.

Consistency: It ensures that the database remains in a consistent state after the successful execution of a transaction.

Normalization Forms and Transitive Dependency

In database management, normalization is the process of organizing data in a database with the aim of minimizing redundancy and dependency.

Transitive dependency occurs in a relation when there are three or more attributes which are related to one another in such a way that one attribute is dependent on another attribute, which in turn is dependent on a third attribute.

Normalization forms (1NF, 2NF, 3NF, BCNF) are a series of guidelines used to determine the level of redundancy present in a relation within a database schema.

Answer: The 3NF (Third Normal Form) is based on the transitive dependency and states that every non-primary key attribute must be directly dependent on the primary key, and not transitively dependent on it.


Consider the following relation:

Student(id, name, course, course coordinator)

Here, course coordinator is transitively dependent on id through course, because course determines the course coordinator and id determines the course. To remove the transitive dependency, we split the relation into two relations:

Student(id, name, course)

Course(coordinator, course)

This eliminates the transitive dependency and the relation is now in 3NF.

Lowest Level of Abstraction for Data Storage

In terms of data storage, the lowest level of abstraction is the physical level. At this level, we can actually see how the data is stored, including details like storage devices, file formats, and encoding mechanisms. It is the most basic and fundamental level of data storage that describes how the data is physically stored on hardware devices. The other levels of abstraction include the abstract level, view level, and user level, which are built on top of the physical level.

Understanding Data Definition Language (DDL)

In order to perform tasks like creating, altering or deleting the structure of database schema and relations, programmers use Data Definition Language (DDL), which is a standard language used by all modern relational database management systems. DDL is also responsible for managing such objects as tables, indexes, and constraints.

Therefore, the answer to the given question is: "The Data definition language is used for performing tasks like creating the structure of the relations, deleting relations."

Understanding Rows in a Relation

In the context of relational databases, the rows of a relation are commonly known as tuples. Therefore, the correct answer is C: Tuple.

DDL Command

DDL (Data Definition Language) is a set of commands that alters the structure of the database. Among the given options, the command of DDL is "Create." Thus, option c) "Create" is the correct answer.

Automatic Statement Execution Before Commit During Transaction

During a transaction, before committing, which of the following statements is automatically executed in case of a shutdown?

  • Rollback
  • Commit
  • View
  • Flashback

Answer: In case of a shutdown, before committing, Rollback is automatically executed.

//Sample code for illustration purposes only
try {
    //Starting a transaction 
    statement.execute("INSERT INTO table_name(column1, column2, column3) VALUES('value1', 'value2', 'value3')");
    statement.execute("UPDATE table_name SET column1='value4' WHERE column2='value5'");
    statement.execute("DELETE FROM table_name WHERE column3='value6'");
    //Committing transaction before closing connection
} catch (SQLException e) {
    //Rolling back changes in case of an error
} finally {
    //Closing connection after successful commit or rollback

Full Form of TCL

The full form of TCL is Transaction Control Language.

// No code to optimize or rephrase, as this is not a programming question

SQL Command to Remove a Relation from a Database

In SQL, the command used for removing a relation (table) from a database is the `DROP` command.



DROP TABLE table_name;

Explanation: This SQL statement would remove the specified table (`table_name`) from the database. Any associated indexes, triggers, or other elements associated with the table would also be removed.

It's important to note that the `DROP` command is a powerful and irreversible command, so it should be used with caution. Always double-check that you are deleting the correct relation before executing the command.

Understanding DBMS

DBMS stands for Database Management System, which is a software system that enables users to define, create, maintain, and control access to a database. It is a collection of interrelated data that is organized in a structured manner. DBMS provides a set of tools and techniques to store, retrieve, manipulate, and analyze data efficiently. Therefore, it is responsible for managing all the aspects of a database, including security, backup, recovery, concurrency, and integrity. Unlike a file-based system, DBMS provides a centralized approach to data management, which makes it more secure, consistent, and scalable.

Meaning of Rectangles in ER Diagrams

In an ER diagram, rectangles represent entity sets.

Definition of Relation

In database management systems, a relation is a subset of a Cartesian product of a list of domains. It refers to a table in a relational database containing records or rows of data and each column or attribute represents a particular domain or field within the table.

Identifying a Tuple in a Relation

In a relation, a super key is used to uniquely identify a tuple. Other options such as schema, attribute, and domain are not used for this purpose.

Minimal Super Key

The candidate key is referred to as the minimal super key.

Relational Algebra Operations

In relational algebra, there are several operations that can be performed on relations. These operations include union, select, and rename. These can be used to manipulate data and extract information from relational databases.

Union: The union operation combines two relations and produces a new relation that contains all the tuples from the original relations. The duplicate tuples are eliminated in the result.

Select: The select operation is used to filter tuples that satisfy some condition. The condition is specified in the form of an expression that evaluates to true or false for each tuple.

Rename: The rename operation is used to change the name of a relation or the name of its attributes.

Therefore, the correct answer is all of the above, as union, select, and rename are all relational algebra operations.

Explanation of AS clause usage in SQL

In SQL, AS clause is used for renaming a column or a table. It is often used to give a column or a table alias a name that is more meaningful to the user or to make it easier to reference in other parts of the query.

For example, consider a query where we want to retrieve the first name and last name of employees from a table called employee_details. The query would look like:

SELECT employee_details.first_name, employee_details.last_name FROM employee_details;

We can use AS clause to give an alias name to the columns:

SELECT employee_details.first_name AS EmployeeFirstName, employee_details.last_name AS EmployeeLastName FROM employee_details;

The table name can also be given an alias name using AS clause:

SELECT ed.first_name, ed.last_name FROM employee_details AS ed;

In this example, the employee_details table is being renamed as ed and can be referenced as such throughout the query.

AS clause is a powerful tool for renaming columns and tables and making queries more readable and easier to understand.

Database Architecture Levels

In a database, there are three levels of architecture - physical level, view level, and user level.

Data Structures in Hierarchical Model Records

In a Hierarchical Model, data is organized in a tree-like structure. Each record is linked to one or more records located below it in the hierarchy, forming a parent-child relationship.

Therefore, the suitable data structure for implementing a Hierarchical Model is a tree. A tree is a non-linear data structure composed of nodes that are connected to each other by edges. Each node in a tree may have one or more child nodes, and there is only one root node for the entire tree.

In summary, a tree data structure is used to represent Hierarchical Model records.

Representing an ER Diagram

In an ER diagram, entities are represented by rectangles, attributes are represented by ovals, and relationships between entities are represented by diamonds. Each entity has its name written inside the rectangle. Attributes for each entity are listed inside the oval, with a line connecting the oval to the rectangle to indicate the entity that owns the attribute. Relationships are shown by the diamonds, with lines connecting the diamonds to the related entities.

//Example ER diagram representation in code

class Entity {
  String name;
  List<Attribute> attributes;
  List<Relationship> relationships;

class Attribute {
  String name;
  Entity ownerEntity;

class Relationship {
  Entity firstEntity;
  Entity secondEntity;
  String type; // one-to-one, one-to-many, many-to-many, etc.

Common Terminology in Relational Databases

In relational databases, a record is commonly referred to as a tuple.

Therefore, the correct answer is Tuple.


Record = Tuple

Which Normal Form Deals with Multivalued Dependency?

The 4NF normal form is the one that deals with multivalued dependency.

    {/* sample code */}

Identifying Non-SQL Command

Out of the given options, "DELETE" is not a command in SQL.

-- Example of SQL commands
-- Selecting data from a table
SELECT * FROM table_name;

-- Deleting data from a table
DELETE FROM table_name WHERE column_name = 'value';

-- Ordering data
SELECT * FROM table_name ORDER BY column_name ASC/DESC;

Concurrency-Based Protocols

In concurrency control, there are various protocols to ensure the consistency of database transactions. The given options are all examples of concurrency-based protocols:

- Lock based protocol - Two-phase locking protocol - Timestamp ordering protocol

Therefore, the correct answer is option D - All of the above.

Choosing the Appropriate Foreign Key Constraint

In order to maintain data accuracy and prevent issues such as dangling references or orphaned records, a database administrator must choose the correct foreign key constraint to ensure referential integrity between tables. The correct option among the given choices is "Referential integrity" as it pertains to the use of foreign key constraints to enforce relationships between tables. This constraint ensures that a value inserted into a foreign key column references an existing primary key value in the referenced table. By enforcing referential integrity, it becomes impossible to create orphaned records or dangling references, thereby maintaining the integrity of the data in the database.

Rewrite: Naming Convention for Subqueries

A subquery is the name given to a query that is placed within a WHERE or HAVING clause of another query.

Removing a Stored Function from a Database using SQL

To remove a stored function from a database, the DROP command is used in SQL.

The syntax for the DROP command is as follows:

DROP FUNCTION function_name;

Where "function_name" is the name of the function you wish to remove from the database.

For example, if you want to remove a stored function named "calculate_age" from the database, you can use the following SQL code:

DROP FUNCTION calculate_age;

This will remove the "calculate_age" function from the database.

It is important to note that the DROP command permanently removes the function from the database. Therefore, it is recommended to use this command with caution and only when necessary.

Determining when to use Modify operation

The Modify operation is typically done after the Look-up operation has been performed to retrieve the desired data from the database. Once the desired data has been located, the Modify operation can be used to make changes or updates to the information. It is not typically used after the Insert or Delete operations, as those operations are focused on creating or removing data rather than modifying existing data. Therefore, the correct answer is: Look-up.

Command for changing data in a table

The command used to change data in a table is the UPDATE command.

UPDATE table_name SET column_name = new_value WHERE condition;

The above code updates the specified column with a new value in the specified table, where the specified condition is true.

Identifying Normal Forms and Single Entities

In the context of database design, the normal forms are used to ensure data consistency and eliminate redundancy. The fourth normal form (4NF) is a higher level of normalization that achieves a higher degree of data integrity than the third normal form (3NF).

The answer to the question is incorrect. The normal form that contains information about a single entity is the first normal form (1NF). 1NF defines that the values in a column should be atomic, meaning that they cannot be divided into smaller elements.

To identify whether a relation is in 4NF, we need to check if it satisfies all the conditions of 3NF and has no non-trivial multivalued dependencies. A non-trivial multivalued dependency is when, for example, a single attribute can have multiple values.

In 4NF, for each non-trivial multivalued dependency X -> Y, X is a superkey, meaning that the values in X uniquely identify the values in Y.

Therefore, to ensure data consistency and avoid redundancy, it is essential to identify single entities and normalize them to the first normal form.

Optimizing a SQL query


SELECT name, course_id 
FROM instructor, teaches 
WHERE instructor_ID= teaches_ID; 

The given query selects the name of instructors and their respective course ids. The tables `instructor` and `teaches` are being joined on the condition that the instructor ID equals the teaches ID. This query can be rewritten using the `NATURAL JOIN` keyword to join the two tables based on matching column names.

Rewritten query:

SELECT name, course_id 
FROM instructor NATURAL JOIN teaches;

This query is more concise and easier to read. It achieves the same result as the previous query.

Option B is not correct as the query does not use the `NATURAL JOIN` keyword and the join condition is incorrect.

Option C only selects the name of instructors, not their course ids.

Option D only selects the course ids, but not the names of instructors.

Therefore, the correct answer is:

Select name, course_id from instructor natural join teaches;

Full Form of NTFS

The full form of NTFS is New Technology File System.

Understanding Cardinality in Relational Databases

In a relational database, the number of tuples (or rows) in a table is referred to as its cardinality. It is an important concept in database design and is used to measure the size of a table in terms of the number of records it contains. The cardinality of a table can be small, medium, or large, depending on the number of rows it has. Understanding the cardinality of a table is important for query performance and optimization.

Definition of Relational Calculus

Relational calculus is a specific type of non-procedural language used to describe what data needs to be retrieved. It is different from procedural languages as it does not explain the sequence of steps required to retrieve data.

Understanding the Conceptual View of a Database

In database management, the total view of a database is known as the conceptual view. It is an abstract representation of the database that describes the overall structure and organization of data without detailing the physical implementation of the system.

This level of abstraction provides a clear and concise overview of the data within the system, making it easier to manage and understand.

The other views of a database include the physical view, which describes how data is stored on disks and tapes, the internal view which defines the way data is organized and accessed by the database management system, and the external view which caters to the specific needs of individual users or groups.

Key Representing Relationships between Tables

In a relational database, a foreign key is used to represent the relationship between two tables. A foreign key is a column or set of columns in one table that refers to the primary key of another table.

There are other types of keys as well:

- Primary key: A primary key is a unique identifier for a record in a table. - Candidate key: A candidate key is a column or set of columns that can uniquely identify a record in a table. - Super key: A super key is a set of columns that can uniquely identify a record in a table, but may also contain additional columns that are not necessary for uniqueness.

However, the foreign key is specifically used to create a link between tables and enforce referential integrity.

Command to Find Number of Values in a Column

In SQL, the correct command to find the number of values in a column is COUNT.


For example, if we want to find the number of values in a column named "salary" from a table named "employees", we can use the following SQL query:

SELECT COUNT(salary) FROM employees;

This will return the total count of values in the "salary" column for all rows in the "employees" table.

Modifying a Column in a Table in SQL

When we need to change the structure of a table in SQL, we use the ALTER command. The ALTER command allows us to modify columns, add or remove constraints, and change the data type of a column.

To modify a specific column in a table, we use the following syntax:

ALTER TABLE table_name
MODIFY COLUMN column_name new_data_type;

For example, if we want to change the data type of the 'age' column in a table called 'employees' from INT to FLOAT, we would use the following command:

ALTER TABLE employees

Therefore, the correct command to modify a column in a table is ALTER.

Understanding Entity Properties

In a database, entities are represented by tables which contain records or rows of data. Each table has properties referred to as entity properties. These properties include:

- Attributes: These are characteristics or qualities of the entities. For example, a customer entity may have attributes such as name, address, phone number, and email.

- Primary key: This is a unique identifier for each record in the entity. It is used to distinguish one record from another.

- Foreign key: This is a field in one entity that refers to the primary key of another entity. It is used to establish relationships between entities.

- Relationships: These are associations between entities. Relationships can be one-to-one, one-to-many, or many-to-many.

- Indexes: These are used to increase the performance of database queries by speeding up data retrieval.

Therefore, the correct entity properties are attributes, primary key, foreign key, relationships, and indexes. Switchboards and groups are not entity properties.

Primary Key Constraints


//The primary key column(s) in a table should always have a NOT NULL constraint
CREATE TABLE table_name (
    column1 datatype NOT NULL,
    column2 datatype PRIMARY KEY,
    column3 datatype NOT NULL


A primary key is a column or set of columns that uniquely identifies each row in a table. It is a vital aspect of a relational database table and should always have a NOT NULL constraint, which means it cannot have NULL values. This is because NULL values are not considered unique and can cause unexpected errors in the database. Therefore, the correct answer is NOT NULL.

Using Projection Command to Select Particular Columns

In Structured Query Language (SQL), the keyword "projection" is used to select specific columns from a table.

For example, suppose we have a table called "students" with columns "id", "name", "age", and "gender". To select only the "name" and "age" columns, we can use the following projection command:

SELECT name, age FROM students;

Therefore, the correct answer to the given question is PROJECTION.

Identifying Non-Physical Database Objects

In a database, there are objects that do exist physically, such as tables, and there are objects that exist logically, such as a view. Here, the correct answer is:

View: A view is a logical, virtual table created by a query, and it does not exist physically. Instead of containing data, a view consists of a query that pulls data from one or more tables. It offers a way to present data in a specific format and can be used to protect sensitive data or limit access to certain data for a particular group of users.

On the other hand, the physical objects include:

  • Base Table: It is a table where actual data is stored physically.
  • Index: It is a physical structure containing pointers to data in a table to improve the speed of data retrieval.

Terminology: NATURAL JOIN

In database management systems, NATURAL JOIN is a type of JOIN operation that combines two tables based on all matching column names between them. The resulting table contains only one column for each pair of matched columns.

It is important to note that NATURAL JOIN can also be referred to as a combination of Projection and cartesian product. This is because it projects the columns with the same names from the two tables and then performs a cartesian product on those columns.

Comparison Operator for Literal Values

The BETWEEN operator is used to compare a value to a list of literal values that have been specified.

The other operators have different functions:

  • ANY:Used to compare a value to any value in a list or subquery.
  • IN:Used to compare a value to a list of possible values.
  • ALL:Used to compare a value to all values in a list or subquery.

Maximum Children in a B-Tree

The correct answer is: m.

Explanation: A B-tree of order m can have at most m children. Therefore, the maximum number of children in a B-tree of order m is m.


In database management systems, a self join occurs when a table is joined with itself. This can be useful for comparing rows within a table or generating a hierarchical query. The resulting output will have two or more copies of the same table. Therefore, a table joined with itself is called a Self Join.


In SQL, the COUNT function is used to return the number of rows that match a specified condition or to count the total number of rows in a table. The COUNT function can be used with or without a GROUP BY clause. When used with GROUP BY, it returns the number of groups. However, when used without GROUP BY, it returns the total number of rows. Therefore, the correct answer is:

Returns total values

Valid SQL Data Types

All of the following are valid SQL data types:




Therefore, the correct answer is:

All of the above

Advantages of Database Views

Database views offer several advantages:

  • Derived columns: Views allow the creation of new columns derived from calculations on existing columns, providing a simplified and easy-to-understand representation of the data.
  • Data security: Views enable access control to specific data by allowing users to only view certain columns or rows of the data, ensuring data security and privacy.
  • Hiding of complex queries: Views hide the complexity of queries, providing users with simple and easy-to-understand queries, enhancing user experience.

Therefore, the correct answer is: All of the above.

Technical Interview Guides

Here are guides for technical interviews, categorized from introductory to advanced levels.

View All

Best MCQ

As part of their written examination, numerous tech companies necessitate candidates to complete multiple-choice questions (MCQs) assessing their technical aptitude.

View MCQ's
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.