DBMS OS CN OOPs MostFrequentlyAskedQuestions
DBMS OS CN OOPs MostFrequentlyAskedQuestions
Welcome to the ultimate resource for acing technical interviews! This sheet is a comprehensive compilation of the
most frequently asked questions across product-based companies, service-based companies, and startups. It
covers essential topics like DBMS, Operating Systems (OS), Object-Oriented Programming (OOPs), and
Computer Networks—core subjects that are vital for any technical role.
Whether you're preparing for your first interview or brushing up for an advanced role, this sheet ensures you're
equipped with the right knowledge to tackle the toughest questions confidently.
A huge shoutout to Javatpoint and GeeksforGeeks for their incredible content that served as a reference and
inspiration. Their dedication to creating high-quality educational material has been instrumental in shaping this guide.
For more insightful content and in-depth explanations, check out my YouTube channel:
https://www.youtube.com/@shivamlucknowi
Let’s get started and take a step closer to cracking your dream job! 🚀
DBMS Interview Questions
A list of top frequently asked DBMS interview questions and answers are given below.
1) What is DBMS?
DBMS is a collection of programs that facilitates users to create and maintain a
database. In other words, DBMS provides us an interface or tool for performing
different operations such as the creation of a database, inserting data into it,
deleting data from it, updating the data, etc. DBMS is a software in which data is
stored in a more secure way as compared to the file-based system. Using DBMS,
we can overcome many problems such as- data redundancy, data inconsistency,
easy access, more organized and understandable, and so on. There is the name of
some popular Database Management System- MySQL, Oracle, SQL Server,
Amazon simple DB (Cloud-based), etc.
2) What is a database?
A Database is a logical, consistent and organized collection of data that it can
easily be accessed, managed and updated. Databases, also known as electronic
databases are structured to provide the facility of creation, insertion, updating of
the data efficiently and are stored in the form of a file or set of files, on the
magnetic disk, tapes and another sort of secondary devices. Database mostly
consists of the objects (tables), and tables include of the records and fields. Fields
are the basic units of data storage, which contain the information about a
particular aspect or attribute of the entity described by the database. DBMS is
used for extraction of data from the database in the form of the queries.
The data can be stored in the database with ease, and there are no issues of data
redundancy and data inconsistency.
The data will be extracted from the database using DBMS software whenever
required. So, the combination of database and DBMS software enables one to
store, retrieve and access data with considerate accuracy and security.
There are two ways which can help the DBMS in recovering and maintaining the
ACID properties, and they are- maintaining the log of each transaction and
maintaining shadow pages. So, when it comes to log based recovery system,
checkpoints come into existence. Checkpoints are those points to which the
database engine can recover after a crash as a specified minimal point from
where the transaction log record can be used to recover all the committed data
up to the point of the crash.
9) What is RDBMS?
RDBMS stands for Relational Database Management Systems. It is used to
maintain the data records and indices in tables. RDBMS is the form of DBMS
which uses the structure to identify and access data concerning the other piece
of data in the database. RDBMS is the system that enables you to perform
different operations such as- update, insert, delete, manipulate and administer a
relational database with minimal difficulties. Most of the time RDBMS use SQL
language because it is easily understandable and is used for often.
Database language implies the queries that are used for the update, modify and
manipulate the data.
Let r be the relation which contains set tuples (t1, t2, t3, ..., tn). Each tuple is an
ordered list of n-values t=(v1,v2, ...., vn).
One-To-One: Here one record of any object can be related to one record of
another object.
○ Inconsistent
○ Not secure
○ Data redundancy
○ Difficult in accessing data
○ Data isolation
○ Data integrity
○ Concurrent access is not possible
○ Limited data sharing
○ Atomicity problem
For example: We know that most of the users prefer those systems which have a
simple GUI that means no complex processing. So, to keep the user tuned and
for making the access to the data easy, it is necessary to do data abstraction. In
addition to it, data abstraction divides the system in different layers to make the
work specified and well defined.
Physical level: It is the lowest level of abstraction. It describes how data are stored.
Logical level: It is the next higher level of abstraction. It describes what data are
stored in the database and what the relationship among those data is.
View level: It is the highest level of data abstraction. It describes only part of the
entire database.
For example- User interacts with the system using the GUI and fill the required
details, but the user doesn't have any idea how the data is being used. So, the
abstraction level is entirely high in VIEW LEVEL.
Then, the next level is for PROGRAMMERS as in this level the fields and records
are visible and the programmers have the knowledge of this layer. So, the level of
abstraction here is a little low in VIEW LEVEL.
Procedural DML or Low level DML: It requires a user to specify what data are
needed and how to get those data.
Non-Procedural DML or High level DML:It requires a user to specify what data are
needed without specifying how to get those data.
○ select
○ project
○ set difference
○ union
○ rename,etc.
For example: If a student is an entity in the table then age will be the attribute of
that student.
Entity Integrity : It specifies that "Primary key cannot have a NULL value."
Referential Integrity: It specifies that "Foreign Key can be either a NULL value or
should be the Primary Key value of other relation
Intension: Intension is also known as Data Schema and defined as the description
of the database, which is specified during database design and is expected to
remain unchanged. The Intension is a constant value that gives the name,
structure of tables and the constraints laid on it.
37) What is System R? How many of its two major
subsystems?
System R was designed and developed from 1974 to 1979 at IBM San Jose
Research Centre. System R is the first implementation of SQL, which is the
standard relational data query language, and it was also the first to demonstrate
that RDBMS could provide better transaction processing performance. It is a
prototype which is formed to show that it is possible to build a Relational System
that can be used in a real-life environment to solve real-life problems.
○ Research Storage
○ System Relational Data System
It makes you able to modify the schema definition in one level should not affect
the schema definition in the next higher level.
Physical Data Independence: Physical data is the data stored in the database. It is
in the bit-format. Modification in physical level should not affect the logical level.
For example: If we want to manipulate the data inside any table that should not
change the format of the table.
Logical Data Independence: Logical data in the data about the database. It
basically defines the structure. Such as tables stored in the database.
Modification in logical level should not affect the view level.
For example: If we need to modify the format of any table, that modification
should not affect the data inside it.
NOTE: Logical Data Independence is more difficult to achieve.
Physical level: It is the lowest level of abstraction. It describes how data are stored.
Logical level: It is the next higher level of abstraction. It describes what data are
stored in the database and what relationship among those data.
View level: It is the highest level of data abstraction. It describes only part of the
entire database.
For example- User interact with the system using the GUI and fill the required
details, but the user doesn't have any idea how the data is being used. So, the
abstraction level is absolutely high in VIEW LEVEL.
Then, the next level is for PROGRAMMERS as in this level the fields and records
are visible and the programmer has the knowledge of this layer. So, the level of
abstraction here is a little low in VIEW LEVEL.
○ Theta join
○ Natural join
○ Equi join
○ The table is in 1NF, i.e., firstly it is necessary that the table should follow
the rules of 1NF.
○ Every non-prime attribute is fully functionally dependent on the
primary key, i.e., every non-key attribute should be dependent on the
primary key in such a way that if any key element is deleted, then even
the non_key element will still be saved in the database.
Where:
X->Y
Y does not -> X
Y->Z so, X->Z
○ It is in 3NF.
○ For every functional dependency X->Y, X should be the super key of the
table. It merely means that X cannot be a non-prime attribute if Y is a
prime attribute.
DURABILITY: This property ensures that once the transaction is committed it will
be stored in the non-volatile memory and system crash can also not affect it
anymore.
○ DELETE command delete only those rows which are specified with the
WHERE clause.
○ DELETE command can be rolled back.
○ DELETE command maintain a log, that's why it is slow.
○ DELETE use row lock while performing DELETE function.
○ The TRUNCATE command removes all the rows from the table.
○ The TRUNCATE command cannot be rolled back.
○ The TRUNCATE command doesn't maintain a log. That's why it is fast.
○ TRUNCATE use table log while performing the TRUNCATE function.
Primary key: The Primary key is an attribute in a table that can uniquely identify
each record in a table. It is compulsory for every table.
Candidate key: The Candidate key is an attribute or set of an attribute which can
uniquely identify a tuple. The Primary key can be selected from these attributes.
Super key: The Super key is a set of attributes which can uniquely identify a tuple.
Super key is a superset of the candidate key.
Foreign key: The Foreign key is a primary key from one table, which has a
relationship with another table. It acts as a cross-reference between tables.
4) What is a socket?
A socket is used to make connection between two applications. Endpoints of the
connection are called socket.
6) What is kernel?
Kernel is the core and most important part of a computer operating system
which provides basic services for all parts of the OS.
○ New Process
○ Running Process
○ Waiting Process
○ Ready Process
○ Terminated Process
2) Hold and Wait Condition: It specifies that there must be a process that is
holding a resource already allocated to it while waiting for additional resource
that are currently being held by other processes.
Note: This condition implies the hold-and-wait condition, but it is easier to deal
with the conditions if the four are considered separately.
○ Binary semaphores
○ Counting semaphores
32) What is a binary Semaphore?
Binary semaphore takes only 0 and 1 as value and used to implement mutual
exclusion and synchronize concurrent processes.
After fragmentation
The Batches contains jobs of such a kind that the jobs or processes which are
very similar in the procedure to be followed by the jobs or processes. The Batch
Operating System has an operator which performs these tasks.
An operator groups together comparable jobs or processes that have the same
criteria into batches. The operator is in charge and takes up the job of grouping
jobs or processes with comparable requirements.
1. The time which the Operating System is at rest is very small or also known as Idle
Time for the Operating System is very small.
2. Very big tasks can also be managed very easily with the help of Batch Operating
Systems
3. Many users can use this Batch Operating Systems.
4. It is incredibly challenging to estimate or determine how long it will take to finish
any task. The batch system processors are aware of how long a work will take to
complete when it is in line.
1. If any work fails in the Batch Operating System, the other jobs will have to wait for
an indeterminate period of time.
2. Batch Operating systems are very challenging to debug,
3. Batch Operating Systems can be expensive at times
4. The computer operators who are using Batch Operating Systems must to be
knowledgeable with batch systems.
1. File Management
2. Job Management
3. Process Management
4. Device Management
5. Memory Management
46) What are the Services provided by the Operating System?
The services provided by the Operating Systems are:
1. Communication
2. Information Maintenance
3. File Management
4. Device Management
5. Process Contro
49) What are the functions which are present in the Process
Control and File Management System Call?
The Functions present in Process Control System Calls are:
1. Create
2. Allocate
3. Abort
4. End
5. Terminate
6. Free Memory
50) What are the functions which are present in the File
Management System Call?
The Functions present in File Management System Calls are:
1. Create
2. Open
3. Read
4. Close
5. Delete
The fundamental unit of work that has to be implemented in the system is called
a process.
As data structure for processes is done in terms of the Process Control Block
(PCB), it is crucial for process management. Additionally, it describes the
operating system's present condition.
1. Process State
2. Process Number
3. Program Counter
4. Registers
5. Memory Limits
6. List of Open Files
55) What are the Files used in the Process Control Block?
The Files used in Process Control Block are:
1. The code becomes more challenging to maintain and debug as there are more
threads.
2. The process of creating threads uses up system resources like memory and CPU.
3. Because unhandled exceptions might cause the application to crash, we must
manage them inside the worker method.
They are treated like single-threaded processes under this system. User Kernel
Threads are smaller and quicker than kernel-level threads
The User Kernel Threads are represented by a Small Process Control Block (PCB),
Stack, Program Counter (PC), Stack.
1. Kernel-level threads allow the scheduling of many instances of the same process
across several CPUs.
2. The kernel functions also support multithreading.
3. Another thread of the same process may be scheduled by the kernel if a
kernel-level thread is stalled.
1. To pass control from one thread in a process to another, a mode switch to kernel
mode is necessary.
2. Compared to user-level threads, kernel-level threads take longer to create and
maintain.
The old process must wait in a ready queue while a new one is running in the
system. At the point when another process interrupted it, the old process
resumes execution.
Dispatcher is the one who moves Scheduler is the one which selects a
the process to the desired state process which is feasible to be
executed at this point of time.
1. Wait or P Function ()
2. Signal or V Function ()
The operating system has trouble authorizing and preventing processes from
entering the crucial part because more than one process cannot operate in the
critical area at once.
1. Deadlock Prevention
2. Deadlock Detection and Recovery
3. Deadlock Avoidance
4. Deadlock Ignorance
77) How can we avoid Deadlock?
We can avoid Deadlock by using Banker's Algorithm.
We can recover the process from deadlock state by terminating or aborting all
deadlocked processes one at a time.
Process Pre Emption is also another technique used for Deadlocked Process
Recovery.
The main memory is divided into small blocks called pages. Now, each of the
pages contains the process which is retrieved into main memory and it is stored
in one frame of memory.
It is very important to have pages and frames which are of equal sizes which are
very useful for mapping and complete utilization of memory.
AD
Bus:
○ Bus topology is a network topology in which all the nodes are
connected to a single cable known as a central cable or bus.
○ It acts as a shared communication medium, i.e., if any device wants to
send the data to other devices, then it will send the data over the bus
which in turn sends the data to all the attached devices.
○ Bus topology is useful for a small number of devices. As if the bus is
damaged then the whole network fails.
AD
Star:
Ring
Mesh
○ Mesh topology is a network topology in which all the nodes are
individually connected to other nodes.
○ It does not need any central switch or hub to control the connectivity
among the nodes.
○ Mesh topology is categorized into two parts:
○ Fully connected mesh topology: In this topology, all the nodes are
connected to each other.
○ Partially connected mesh topology: In this topology, all the nodes
are not connected to each other.
Tree
○ Secure
○ Support Encapsulation
○ Distributed database
○ Faster Problem solving
○ Security through redundancy
○ Collaborative Processing
○ Unauthorized Access
○ Viruses
○
○ Frequency of failure
○ Recovery time of a network after a failure
9) What is bandwidth?
Every signal has a limit of upper range frequency and lower range frequency. The
range of limit of network between its upper and lower frequency is called
bandwidth.
AD
A router sends the data between two similar networks while gateway sends the
data between two dissimilar networks.
AD
Working of DNS:
If you want to visit the website of "javaTpoint", then the user will type
"https://www.javatpoint.com" into the address bar of the web browser. Once the
domain name is entered, then the domain name system will translate the
domain name into the IP address which can be easily interpreted by the
computer. Using the IP address, the computer can locate the web page
requested by the user.
○ Domain: Users that use the same database will be grouped into a
single domain.
○ Tree: Multiple domains can be grouped into a single tree.
○ Forest: Multiple trees can be grouped into a single forest.
25) What is RAID?
RAID is a method to provide Fault Tolerance by using multiple Hard Disc Drives.
The Domain Name System is the second type supporting program that is used
by other programs such as to find the IP address of an e-mail recipient.
○ Network layer: Layer 1, Layer 2 and layer 3 are the network layers.
○ Transport layer: Layer 4 is a transport layer.
○ Application layer. Layer 5, Layer 6 and Layer 7 are the application layers.
1. Physical Layer
2. DataLink Layer
○ It is used for transferring the data from one node to another node.
○ It receives the data from the network layer and converts the data into
data frames and then attach the physical address to these frames
which are sent to the physical layer.
○ It enables the error-free transfer of data from one node to another node.
Functions of Data-link layer:
○ Frame synchronization: Data-link layer converts the data into frames,
and it ensures that the destination must recognize the starting and
ending of each frame.
○ Flow control: Data-link layer controls the data flow within the network.
○ Error control: It detects and corrects the error occurred during the
transmission from source to destination.
○ Addressing: Data-link layer attach the physical address with the data
frames so that the individual machines can be easily identified.
○ Link management: Data-link layer manages the initiation, maintenance
and, termination of the link between the source and destination for the
effective exchange of data.
3. Network Layer
○ Network layer converts the logical address into the physical address.
○ It provides the routing concept means it determines the best route for
the packet to travel from source to the destination.
Functions of network layer:
○ Routing: The network layer determines the best route from source to
destination. This function is known as routing.
○ Logical addressing: The network layer defines the addressing scheme to
identify each device uniquely.
○ Packetizing: The network layer receives the data from the upper layer
and converts the data into packets. This process is known as
packetizing.
○ Internetworking: The network layer provides the logical connection
between the different types of networks for forming a bigger network.
○ Fragmentation: It is a process of dividing the packets into the
fragments.
4. Transport Layer
6. Presentation Layer
7. Application Layer
1. Application Layer
2. Transport Layer
3. Internet Layer
4. Network Layer
46) What is the difference between TCP/IP model and the OSI
model?
Following are the differences between the TCP/IP model and OSI model:
TCP/IP is more reliable than the OSI OSI model is less reliable as
model. compared to the TCP/IP model.
TCP/IP model developed the OSI model developed the model first
protocols first and then model. and then protocols.
In Network layer, TCP/IP model In the Network layer, the OSI model
supports only connectionless supports both connection-oriented
communication. and connectionless communication.
Workgroup Domain
○ Python
○ Java
○ Go
○ Dart
○ C++
○ C#
○ Ruby
○ Inheritance
○ Encapsulation
○ Polymorphism
○ Data Abstraction
Disadvantages of OOP
○ Encapsulation
○ Inheritance
○ Polymorphism
○ Abstraction
○ All predefined types are objects
○ All user-defined types are objects
○ All operations performed on objects must be only through methods
exposed to the objects.
Class Object
It is conceptual. It is real.
It uses the keyword class when It uses the new keyword to create an
declared. object.
A class can exist without any object. Objects cannot exist without a class.
12) What are the key differences between class and structure?
Class Structure
It deals with data members and It deals with data members only.
member functions.
It's members are private by default. It's members are public by default.
Useful while dealing with the Useful while dealing with the small
complex data structure. data structure.
The example of manipulators that do not have arguments is endl, ws, flush, etc.
Manipulators with arguments are setw(val), setfill(c), setbase(val), setiosflags(flag).
Some other manipulators are showpos, fixed, scientific, hex, dec, oct, etc.
Constructor Method
Constructor has the same name as The method name and class name
the class name. are not the same.
It does not have any return type. It must have a return type.
Examples of POP are C, VB, Examples of OOPs are C++, Java, C#,
FORTRAN, Pascal, etc. .NET, etc.
Runtime Polymorphism
Both the objects use separate Both objects share the same
memory locations. memory but use the two different
reference variables that point to the
same location.
Inheritance Polymorphism
Inheritance is one in which a derived Polymorphism is one that you can
class inherits the already existing define in different forms.
class's features.
Objects that are independent of one another and do not directly modify the state
of other objects is called loosely coupled. Loose coupling makes the code more
flexible, changeable, and easier to work with.
Objects that depend on other objects and can modify the states of other objects
are called tightly coupled. It creates conditions where modifying the code of one
object also requires changing the code of other objects. The reuse of code is
difficult in tight coupling because we cannot separate the code.
new: Hides the original method (which doesn't have to be virtual), providing
different functionality. This should only be used where it is absolutely necessary.
When you hide a method, you can still access the original method by upcasting
to the base class. This is useful in some scenarios, but dangerous.
Overloading is a concept in OOP when two or more methods in a class with the
same name but the method signature is different. It is also known as
compile-time polymorphism. For example, in the following code snippet, the
method add() is an overloaded method.
If a method with the same method signature is presented in both child and
parent class is known as method overriding. The methods must have the same
number of parameters and the same type of parameter. It overrides the value of
the parent class method. It is also known as runtime polymorphism. For example,
consider the following program.
class Dog
{
public void bark()
{
System.out.println("woof ");
}
}
class Hound extends Dog
{
public void sniff()
{
System.out.println("sniff ");
}
//overrides the method bark() of the Dog class
public void bark()
{
System.out.println("bowl");
}
}
public class OverridingExample
{
public static void main(String args[])
{
Dog dog = new Hound();
//invokes the bark() method of the Hound class
dog.bark();
}
}
High cohesion often associates with loose coupling and vice versa.
○ At home a person can play the role of father, husband, and son.
○ At the office the same person plays the role of boss or employee.
○ In public transport, he plays the role of passenger.
○ In the hospital, he can play the role of doctor or patient.
○ At the shop, he plays the role of customer.
○ Abstract class
○ Abstract method
36) What are the levels of data abstraction?
There are three levels of data abstraction:
○ Physical Level: It is the lowest level of data abstraction. It shows how the
data is actually stored in memory.
○ Logical Level: It includes the information that is actually stored in the
database in the form of tables. It also stores the relationship among the
data entities in relatively simple structures. At this level, the information
available to the user at the view level is unknown.
○ View Level: It is the highest level of data abstraction. The actual
database is visible to the user. It exists to ease the availability of the
database by an individual user.
class OverloadMain
{
public static void main(int a) //overloaded main method
{
System.out.println(a);
}
public static void main(String args[])
{
System.out.println("main method invoked");
main(6);
}
}
JVM first executes the static block on a priority basis. It means JVM first goes to
static block even before it looks for the main() method in the program. After that
main() method will be executed.
class Demo
{
static //static block
{
System.out.println("Static block");
}
public static void main(String args[]) //static method
{
System.out.println("Static method");
}
}