Past Year Questions of DBMS(2020-2024 and Model Questions)

Go back to:

CHECK OUT THE NOTES:


Q.What is Database and DBMS? List out the advantages and disadvantages of DBMS.

A Database is a structured collection of data that can be stored in both physical and digital form for easy and simple access and management. For eg: A phonebook is an example of physical database and an online banking system can be example of digital database.
A Database Management System (DBMS) is software that manages digital databases, providing users and applications an interface to interact with data efficiently.

Advantages of DBMS are reduced data redundancy(data isnt repeated), improved data integrity i.e. it ensures that data is recorded exactly as intended and remains unchanged and uncorrupted during storage, transfer, and retrieval, enhanced data security, efficient data access, support for backup and recovery, and concurrent user access i.e. multiple users can utilize the database without interfearing with eachother.
It's Disadvantages are increased system complexity, high cost, slower compared to simple file systems due to advanced features such as data integrity, security and querying , and potential security vulnerabilities if not managed properly.


Q.Differentiate between file processing system and DBMS. Give at least four points.
File Processing System DBMS
Data Redundancy is High, because data is stored in multiple separate files. Data Redundancy is Low, data is centralized to minimize duplication.
Data Consistency is difficult to maintain due to redundant data. Data Consistency is ensured by DBMS.
Data Security is limited or present in form of manual security controls. Data Security is built-in security features to control access.
Data Access is mostly sequential and slower access. Data Access is efficient, flexible access using querying languages like SQL.


Q.Explain the different models of DBMS with advantages and disadvantages.

There are several types of DBMS models used to organize and manage data. Each model has its own structure, advantages, and disadvantages:

1. Hierarchical Model:
Data is organized in a tree-like structure using parent-child relationships, where each child has only one parent.

Advantages:
– Simple and easy to understand.
– Efficient for data with a clear hierarchy (e.g., organizational charts).

Disadvantages:
– Rigid structure; difficult to modify.
– Cannot efficiently represent many-to-many relationships.
– Requires data duplication in certain cases.

2. Network Model:
Similar to the hierarchical model but allows many-to-many relationships through the use of sets and pointers.

Advantages:
– More flexible than the hierarchical model.
– Supports complex relationships and efficient access.

Disadvantages:
– Complex structure; difficult to design and maintain.
– Requires knowledge of physical data paths.

3. Relational Model:
Data is stored in tables (called relations) consisting of rows and columns. It is the most widely used model today.

Advantages:
– Simple and easy to understand.
– Uses powerful query language (SQL).
– Ensures data integrity and minimizes redundancy.

Disadvantages:
– May not perform as well with very large or complex data structures.
– Can be inefficient in handling hierarchical or graph-based data.

4. Object-Oriented Model:
Data is stored as objects, similar to how it is handled in object-oriented programming languages. It supports complex data types.

Advantages:
– Suitable for complex data types like multimedia and engineering designs.
– Integrates well with object-oriented programming.

Disadvantages:
– Less widely adopted.
– More complex to design and manage.
– Limited support and tools compared to relational DBMS.


Q.What is a relational database? How is it different from other database models?

A relational database is a type of database which stores data in the form of tables called relations.Each table consists of rows called records and columns called attributes. In this, keys are used to to establish and enforce relationships between tables thus data integrity is maintained and redundancy is reduced. SQL (Structured Query Language) is the most commonly used language to manage such databases.

Relational databases differ from other models in several ways:
– Unlike the hierarchical model, which organizes data in a tree structure, relational databases use tabular format, making data more flexible and easier to manage.
– Unlike the network model, which allows complex many-to-many relationships using pointers, relational databases use foreign keys and join operations to represent such relationships.
– Compared to object-oriented databases, relational databases are simpler and more widely supported, but may not handle complex data types as efficiently.

Relational databases are preferred for their simplicity, scalability, and support for powerful query languages.


Q.What is data redundancy? How does DBMS help in reducing it?

Dublication/ repetation of the same data multiple times in a database is called data redundancy. An exaple of data redundancy can be taken when contact info of a customer is stored in seperate files. This means that if the contact info has to be updated, then it should be done on all files else there would be inconsistency. DBMS helps prevent this by using a centeralized data storage and using relations and normalization to break down the table where common data is linked using keys. So update can be made in a single place hence saving time, ensuring consistency and less storage is used.


Q.Write differentiate between centralized and distributed database systems.
Centralized Database System Distributed Database System
All data is stored and maintained at a single central location. Data is distributed across multiple physical locations.
Slower access for users far from the central server. Faster access for local users due to localized storage.
Less relaiable as if the central server fails, the system is inaccessible. More reliable as even if one site fails, others can still function independently.
Easier to manage, back up, and secure due to central control. More complex to manage and synchronize across multiple sites.
Lower setup and maintenance costs. Higher setup and maintenance costs due to multiple servers.
More secure. Less secure due to the larger number of variables.

Q.Who is Database Administrator (DBA)? What are the major responsibilities of DBA?

A Database Administrator (DBA) is a person responsible for the installation, configuration, management, maintenance, and security of a database system. The DBA ensures that databases run efficiently, securely, and are always available for users and applications.

Major responsibilities of a DBA include:
– Installing and configuring the DBMS software.
– Creating and managing database structures such as tables, indexes, and views.
– Monitoring database performance and tuning it for efficiency.
– Managing user access, roles, and permissions to ensure data security.
– Performing regular backups and planning recovery strategies in case of data loss.
– Ensuring data integrity and enforcing database standards.
– Applying software patches and updates.
– Coordinating with developers and system administrators to support application requirements and database integration.


Q.Define normalization. Explain 1NF, 2NF and 3NF with suitable examples. Explain the normalization process with examples.

Normalization is the process of organizing data in a database to reduce redundancy (duplicate data) and ensure data integrity. It involves dividing large tables into smaller, related tables and linking them using keys. This makes data easier to maintain, reduces the chance of anomalies (like update or deletion issues), and improves database efficiency.

First Normal Form (1NF):
A table is in 1NF if:
– All values in each column are atomic (indivisible).
– Each record is unique.

Example (Not in 1NF):
StudentIDNameSubject
1RamMath,English
2SitaScience,Math

Conversion to 1NF:
StudentIDNameSubject
1RamMath
1RamEnglish
2SitaScience
2SitaMath

Second Normal Form (2NF):
A table is in 2NF if:
– It is in 1NF.
– All non-key attributes are fully functionally dependent on the primary key (no partial dependency).

Example (In 1NF not 2NF):
StudentIDSubjectTeacher
1MathMr. Sharma
1EnglishMs. Koirala
2ScienceMr. Lama

Here, TeacherName depends only on Subject, not the whole composite key (StudentID + Subject).

Conversion to 2NF:
Main Table:
StudentIDSubject
1Math
1English
2Science

Subject-Teacher Table:
SubjectTeacherName
MathMr. Sharma
EnglishMs. Koirala
ScienceMr. Lama

Third Normal Form (3NF):
A table is in 3NF if:
– It is in 2NF.
– All attributes are only dependent on the primary key, and not on any other non-key attribute (no transitive dependency).

Example (Not in 3NF):
StudentIDStudentNameDepartmentHOD
1RamScienceDr. Sharma
2SitaArtsDr. Joshi

Here, HOD depends on Department, not directly on StudentID.

Conversion to 3NF:
Student Table:
StudentIDStudentNameDepartment
1RamScience
2SitaArts

Department Table:
DepartmentHOD
ScienceDr. Sharma
ArtsDr. Joshi

Normalization Process Summary:
1. Remove repeating groups → 1NF
2. Remove partial dependencies → 2NF
3. Remove transitive dependencies → 3NF

By following these steps, the database becomes more structured, efficient, and easier to maintain.


Q.Explain the terms: primary key, foreign key, and candidate key with examples.

Primary Key:
A primary key is a field (or a combination of fields) that uniquely identifies each record in a table. It cannot have duplicate or NULL values.

Example: In a Student table:
StudentIDNameClass
1Ram12
2Sita11
Here, StudentID is the primary key because it uniquely identifies each student.

Foreign Key:
A foreign key is a field in one table that refers to the primary key of another table. It is used to establish a relationship between two tables.

Example: In a Marks table:
StudentIDSubjectMarks
1Math85
2English90
Here, StudentID is a foreign key because it refers to StudentID in the Student table.

Candidate Key:
A candidate key is any field or combination of fields that can uniquely identify a record in a table. A table can have multiple candidate keys, but only one is selected as the primary key.

Example: In a Student table:
StudentIDEmailPhone
1ram@gmail.com9800000001
2sita@gmail.com9800000002
Here, StudentID, Email, and Phone are all candidate keys because each can uniquely identify a student. One of them (e.g., StudentID) is chosen as the primary key.


Q.What is SQL? Explain its components and common functions.

SQL (Structured Query Language) is a standard language used to manage and manipulate data in a relational database. It allows users to create, read, update, and delete data easily using commands.

SQL is divided into several important components based on what they do:

1. DDL (Data Definition Language):
These commands are used to define the structure of database objects like tables.
CREATE: Creates a new table or database.
ALTER: Modifies the structure of an existing table (e.g., adding a column).
DROP: Deletes a table or database completely.

2. DML (Data Manipulation Language):
These commands are used to manage data inside tables.
INSERT: Adds new data to a table.
UPDATE: Changes data in a table.
DELETE: Removes data from a table.

3. DQL (Data Query Language):
This part is used to query or view data from the database.
SELECT: Retrieves specific or all records from one or more tables.

4. DCL (Data Control Language):
These commands are used to control who can access or change the data.
GRANT: Gives permission to a user.
REVOKE: Takes back permission from a user.

Common SQL Functions:
INSERT INTO table_name VALUES (...): Adds a new record.
SELECT * FROM table_name: Shows all data from a table.
UPDATE table_name SET column = value WHERE condition: Changes specific data.
DELETE FROM table_name WHERE condition: Deletes specific rows based on a condition.

In summary, SQL is a powerful language used to interact with databases in a structured and efficient way.


Q. Show the use of SQL commands like CREATE,SELECT,INSERT,etc.

CODE:

  CREATE DATABASE CompanyDB;
  USE DATABASE CompanyDB;
  CREATE TABLE Employees ( EmployeeID INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50),Age INT,Department VARCHAR(50));

  INSERT INTO Employees (EmployeeID, FirstName, LastName, Age, Department)
  VALUES 
        (1, 'Ram', 'Singh', 30, 'HR'),
        (2, 'Virat', 'Smith', 25, 'IT'),
        (3, 'Micheal', 'Jordon', 40, 'Finance'),
        (4, 'Sherlock', 'Holmes', 35, 'Marketing');
  SELECT * FROM Employees
  WHERE EmployeeID = 1;

  

OUTPUT:

WHAT IT DOES:
The CREATE command is used to create DATABASES, TABLES, etc.
The INSERT command is used to add new records into the tables. eg: if i want to add data of new employee i'd use INSERT command.
The SELECT command is used to search for the records that satisfy the provided condition. In this case where EmployeeID = 1 .i.e it shows all the deatil of the employee whose id is 1.


Q.Define the following terms.
Data DictionaryA data dictionary is a centralized repository that stores information about the structure, organization, and meaning of data in a database. It contains details like table names, column data types, constraints, relationships, and access rights.
Primary Key A primary key is a field (or combination of fields) in a table that uniquely identifies each record. It must be unique and cannot contain NULL values.
RelationshipA relationship in DBMS refers to the connection or association between two or more tables. It is usually created using keys (e.g., primary key and foreign key) to maintain data consistency and enable data retrieval across multiple tables.
Data Manipulation Language (DML)DML is a subset of SQL used to manage data within database objects. It includes commands like SELECT, INSERT, UPDATE, and DELETE to retrieve and manipulate data.
Structured Query Language (SQL)SQL is the standard programming language used to interact with relational databases. It allows users to perform tasks such as querying data, updating records, and managing database structures.
Data IntegrityData integrity refers to the accuracy, reliability, and consistency of data over its lifecycle. It ensures that data is correct and trustworthy, often maintained through constraints and validation rules in DBMS.
Data Definition Language (DDL)DDL is a category of SQL commands used to define and modify the structure of database objects such as tables, views, and indexes. Common DDL commands include CREATE, ALTER, and DROP.
Data SecurityData security involves protecting data from unauthorized access, misuse, or corruption. In a DBMS, this is achieved through user authentication, access controls, encryption, and regular backups.
Database SystemA database system is a collection of programs and data designed to manage and store large amounts of information efficiently. It includes the DBMS software, the actual database, and the users or applications that interact with it.