MUST-DO Questions for Interviews
(DBMS, CN and OS)
(Sheet for the sole purpose of quick revision and preparation in less time)
Previous Sheets:
SDE sheet(Over 500+ success stories): [Link]
&t=6s
CR Sheet:
[Link]
CP Sheet:
(used by most of the competitive programmers to practice and get practice problems)
[Link]
Copyright: Take U Forward (Striver_79)
Channel 1: [Link]
Channel 2: [Link]
Why trust this sheet ?
Ans: Candidate Master, 6*, Currently working with [Link] (Directi), ex Intern at Am
azon India. Major success with the previous sheets, and more importantly trusted by hi
s “TAKEUFORWARD FAM”
Operating System:
1. What is the main purpose of an operating system? Discuss different types?
Ans:- It acts as a intermediary between user and system Hardware.
The main purpose of an operating system is to manage and coordinate computer
hardware and software [Link] security, and provide a stable environment
for running applications
different types:- 1) single user/ single- tasking OS
2) Batch Processing OS
3) multi-programming OS
4) multi-tasking OS
5) Real-time OS
6)Distributed OS
2. What is a socket, kernel and monolithic kernel ?
Ans:- A socket is an endpoint for sending or receiving data across a computer
network, typically identified by an IP address and port number(communication
protocols). Sockets provide a communication mechanism for networked
applications.
Kernel:- The kernel is the core component of an operating system responsible
for managing hardware resources, providing essential services, and mediating
interactions between software and hardware. It serves as the bridge between
applications and the computer's hardware.
monolithic kernel:-
ALL functions run in kernel itself.
High performance as communication is fast (as all functions are in kernel itself).
Less reliable (charo function ek mein hai agar kharab hua toh sab band ho jayega)
bulky in size.
Example :- LINUx
Micro-kernel:-
Only major function are in kernel.
I.e :- memory and process mgmt
Performance is slow
File & I/o mgmt are in user-space
more reliable and stable (as all function are in different group)
Smaller in size,
Example :- L4 LINUX, MINIX
Hybrid kernel:-
Advantages of both (file in user-space and rest in kernel space)
combined approad.
Example :- windows , Mac OS
3. Difference between process and program and thread? Different types of process.
Program:-A program is a set of instructions or code written in a programming language
that can be executed by a computer to perform a specific task or function.
Process:-a program under execution in main memory called process.
Thread:- A thread is a lightweight, smaller unit of a process that can execute
independently, shares the same memory space as the parent process, and can run
concurrently with other threads, enabling multitasking and parallelism in computing.
4. Define virtual memory, thrashing, threads.
Virtual memory:- it is a feature in os , where large program can store themselves in form of
pages while their execution and only the required pages or portion are loaded into main memory.
It gives an illusion to the programmer that program of larger size than actual physical.
memory can be executed.
Virtual memory doesn’t really exists.
Thrashing:-is a phenomenon in virtual memory schemes when the processor
spends most of its time in swapping pages, rather than executing instructions.
Threads:-A thread is a lightweight, smaller unit of a process that can execute independently,
shares the same memory space as the parent process, and can run concurrently with other
threads, enabling multitasking and parallelism in computing.
5. What is RAID ? Different types.
Ans:- RAID:- RAID stands for Redundant Array of Independent Disks. It is used to
store the same data redundantly to improve the overall performance. There are 7
RAID levels.
RAID 0(Striping(distributed)):-
RAID 1(mirroring):-
RAID 10(Striped Mirrors):- It combines both RAID 0 (striping) and RAID 1 (mirroring).
Data is striped for performance, and each stripe is mirrored for redundancy.
RAID 3:- in this we break data in block level and store the parity of data in the disk.
So that if one the disk is failed we can recover the data from parity.
RAID 5:- raid 5 is similer to raid 3 just the parity is distributed across the disk.
6. What is a deadlock ? Different conditions to achieve a deadlock.
Ans:- A situation where a set of processes are blocked because each process is holding a
resource and waiting for another resource acquired by some other process.
Different conditions to achieve a deadlock
1. Mutual Exclusion – One or more than one resource is non-sharable (Only one
process can use at a time).
2. Hold and Wait – A process is holding at least one resource and waiting for
resources.
3. No Preemption – A resource cannot be taken from a process unless the process
releases the resource.
4. Circular Wait – A set of processes are waiting for each other in circular form.
7. What is fragmentation? Types of fragmentation.
ANs:-Fragmentation is a phenomenon of memory wastage. It reduces the capacity
and performance because space is used inefficiently.
TYPES:-
Internal fragmentation:-size of allocated memory is greater then requested memory ,
so the difference of memory is called internal fragmentation.
It occurs when we deal with the systems that have fixed size allocation units.
External fragmentation(means size toh hai but contiguous mein hai):-
Eg:-
it occurs when we deal with the systems that have variable size
allocation units.
8. What is spooling ?
Ans:- simultaneous peripheral operation online Spooling is a technique that
temporarily stores data in memory before it's used by a device or program, ensuring
efficient processing and preventing delays.
9. What is semaphore and mutex (Differences might be asked)? Define Binary se
maphore.
Ans:- semaphores are integers variable.
It is used to solve critical section problem.
semaphores typically involve atomic operations for their operation :- wait and signal
TYPES:
1) Binary Semaphores:-Binary semaphores, also known as mutexes the value will be
0 & [Link] that only one process or thread can access it at a time, providing mutual
exclusion.
2) Counting semaphores:- Counting semaphores refer to the synchronization
mechanisms whose values range from [0,n], wherein n refers to a non-negative integer
greater than one (1).
10. Belady’s Anomaly
Ans:- Belady's Anomaly is a phenomenon in page replacement algorithms where
increasing the number of page frames can unexpectedly lead to more page faults.
11. Starving and Aging in OS
Ans:- Starvation in operating system occurs when a process waits for an indefinite time to
get the resource it requires.
Aging:- while aging is a technique used to prevent this by increasing the priority of
waiting processes over time.
12. Why does trashing occur?
Ans:- Thrashing occurs when a computer spends more time swapping data
between RAM and disk than actually executing tasks, due to excessive memory
demand and poor resource management.
13. What is paging and why do we need it?
Ans:- paging is a storage mechanism used in os to retrieve process from secondary
memory to main memory as pages.
allowing them to use non-contiguous physical memory effectively and simplifying
memory management.
14. Demand Paging, Segmentation
ANs:- demand paging :-Demand paging in os is a technique in which pages are
loaded from disk into main memory only when they are needed, i.e., demanded by the
program. This technique allows the operating system to save memory space by keeping
only those pages in main memory that are currently required by the program
Segmentation:- Segmentation in operating systems is a memory management
technique where the logical address space of a process is divided into segments, each
representing a different part of the program or data. And it gives user view of a
process
15. Real Time Operating System, types of RTOS.
ANs:- A real-time operating system (RTOS) is specialized software designed to manage
tasks and processes with precise timing requirements, ensuring predictable and quick
responses in applications like robotics, aviation, and industrial control systems.
Types:- HARD REAL-TIME OS
SOFT REAL-TIME OS
16. Difference between main memory and secondary memory.
Ans:-
Volatility:
Main Memory (RAM): Volatile memory, which means it loses its data when the
computer is powered off or restarted.
Secondary Memory (Storage): Non-volatile memory, retaining data even when the
computer is turned off.
Speed:
Main Memory (RAM): Much faster access times, allowing the CPU to quickly read
and write data during program execution.
Secondary Memory (Storage): Slower access times compared to RAM, which can
result in longer data retrieval times.
Purpose:
RAM stores data and instructions used by the CPU for quick processing during
program execution.
Secondary Storage is for long-term data storage, like files and the OS, keeping
data even when the computer is off.
Accessibility:
Main Memory (RAM): Directly accessible by the CPU for fast data access and
manipulation.
Secondary Memory (Storage): Accessed through input/output operations, which are
slower than direct memory access.
Capacity:
Main Memory (RAM): Smaller capacity, typically measured in gigabytes (GB) or
terabytes (TB).
Secondary Memory (Storage): Larger capacity, often measured in terabytes (TB) or
petabytes (PB), providing ample space for long-term data storage.
Cost:
Main Memory (RAM): More expensive per unit of storage capacity compared to
secondary memory.
Secondary Memory (Storage): Less expensive per unit of storage capacity, making it
suitable for mass data storage.
Type:
Main Memory (RAM): Typically composed of dynamic random-access memory
(DRAM) or static random-access memory (SRAM) chips.
Secondary Memory (Storage): Includes various types like hard disk drives (HDDs),
solid-state drives (SSDs), optical drives, and magnetic tapes.
17. Dynamic Binding
Ans:-Dynamic binding is a mechanism in programming languages where the choice of
which method or function to call is determined at runtime based on the actual type of the
object or variables involved.
NOTE:- STATIC BINDING BHI HOTA HAI JUST OPPOSITE OF DYNAMIC
18. FCFS Scheduling
Ans:- FCFS (First-Come, First-Served) Scheduling is a simple CPU scheduling algorithm
used in operating systems. It assigns CPU time to processes in the order they arrive in the
ready queue, with the first process that arrives being the first to execute. FCFS is non-
preemptive, meaning once a process starts executing, it runs to completion without
interruption, making it easy to understand but potentially inefficient for long-running
processes.
19. SJF Scheduling
Ans:- SJF (Shortest Job First) Scheduling is a CPU scheduling algorithm used in operating
systems. It assigns CPU time to processes based on their expected execution time, with the
shortest job given the highest priority. SJF can be either preemptive (where a shorter job can
interrupt the execution of a longer one) or non-preemptive (where a shorter job must wait for
the longer one to finish). SJF aims to minimize average waiting time and is optimal for minimi
zing turnaround time when all job lengths are known in advance.
20. SRTF Scheduling
21. LRTF Scheduling
22. Priority Scheduling
23. Round Robin Scheduling
24. Producer Consumer Problem
Ans:- The Producer-Consumer Problem is a classic synchronization problem in computer
science where multiple producer threads generate data items and place them into a shared
buffer, while multiple consumer threads retrieve and process these items from the buffer,
ensuring proper synchronization and avoiding issues like buffer overflows or underflows.
25. Banker’s Algorithm
Ans:-The Banker's Algorithm is a resource allocation and deadlock avoidance method used
by operating systems to ensure safe execution of processes by checking if resource
requests will lead to a safe state and avoiding potential deadlocks. It works by keeping track
of available resources, maximum resource needs, and current resource allocations for
processes.
26. Explain Cache
Ans:-A cache in an operating system is like a quick-access memory that stores frequently
used information, making your computer faster by avoiding the need to fetch data from
slower storage. It's used at various levels, like CPU and disk caches, to speed things up.
27. Diff between direct mapping and associative mapping
Ans:- Direct Mapping: Each cache location corresponds to a specific memory block, simple
but can lead to conflicts.
Associative Mapping: Cache locations can hold multiple memory blocks, reducing conflicts
but requiring more complex hardware.
28. Diff between multitasking and multiprocessing
Ans:- multitasking :- Multitasking runs multiple tasks on a single CPU by time-sharing It
gives the illusion of parallel execution by rapidly switching between tasks.
Resource Usage: It shares a single CPU among multiple tasks, and only one task runs at a
time while others are in a queue or suspended.
Example: Running multiple applications (e.g., a web browser, word processor, and media
player) on a single-core CPU.
multiprocessing :-multiprocessing uses multiple CPUs or CPU cores to execute tasks
simultaneously for true parallelism and enhanced performance.
Resource Usage: It utilizes multiple CPUs or CPU cores to execute tasks simultaneously,
providing true parallelism.
Example: High-performance computing clusters, servers, and modern desktop computers
with multiple CPU cores.
---------------------------------------------------------------------------------------------------
DBMS:
1. What is DBMS ? Mention advantages..
Ans:- Database Management Systems (DBMS) are software systems used to store,
retrieve, and run queries on data. A DBMS serves as an interface between an end-
user and a database, allowing users to create, read, update, and delete data in the
database.
Advantages:-
Data Redundancy Reduction
data integrity(uniqueness)
Scalability(Handling more work without slowdown.)
Data Maintenance
2. What is Database?
Ans:- A database is a structured collection of organized information or data. Via a
social media , news , report and etc.
3. What is a database system?
Ans:- A database system is software that helps users store, manage, and retrieve
data efficiently while providing security and query tools.
4. What is RDBMS ? Properties..
Ans:- A Relational Database Management System (RDBMS) is a type of database m
anagement system that stores and manages data in a structured manner using table
s with rows and columns.
Properties:-
Tabular Structure: Data is organized into tables (relations) co
nsisting of rows (tuples) and columns (attributes).
SQL Support: It uses Structured Query Language (SQL) for q
uerying and manipulating data.
Relationships: RDBMS supports relationships between tables
through foreign keys, enabling data linking and normalization.
ACID Transactions: It ensures data consistency and reliability
through Atomicity, Consistency, Isolation, and Durability (ACI
D) properties.
Indexing: It provides indexing mechanisms for faster data retri
eval.
5. Types of database languages
Ans:- Database languages are commonly divided into 5 language:-
Data Definition Language (DDL) :- create , drop, alter, rename, truncate
Data Manipulation Language (DML):-insert, update, delete
Data Query Language (DQL):- select
Data Control Language (DCL):- grant & revoke permission from users.
Transaction Control Language (TCL):- Commit & rollback
6. ACID properties (VVVVV IMP)
Ans:- ACID is a term that stands for the four fundamental properties that ensure the
reliability and consistency of database transactions in a Database Management
System (DBMS).
Atomicity: Atomicity ensures that a transaction is either fully completed or
completely Rollback in case of any failure.
Consistency: constraints must be maintained before and after transaction. (if
automocity done well consistency work well).
Isolation: Isolation ensures that concurrent transactions do not interfere with each
other.
Durability: after transaction completed successfully the changes should reflect in db
even after failures.
7. Difference between vertical and horizontal scaling
Ans:-
Vertical Scaling:- means adding more capacity(power) to a single resource (e.g.,
upgrading CPU,SSD ,RAM). It is also known as scale up.
Horizontal Scaling:- means adding more resources (e.g., adding servers) to
distribute the load. It is also known as scale out.
8. What is sharding
Ans:- sharding is a technique to implement horizontal scaling. It involves dividing a
large database or dataset into smaller, more manageable parts called "shards". to
improve performance and scalability.
Keys in DBMS
Ans:- there are various key in DBM
Primary key
foreign key
super key :- taking one or more attribute and combine them and which can uniquely
identified is known as super key.
Composite Key:- A composite key is a primary key that consists of two or more
columns. It is used when a single column cannot provide unique identification.
9. Types of relationship
Ans:- there are 4 types of rltnship in DBMS
1:1
Eg:- school has 1 principle
1:many(n)
Eg:- person can own many car
Many(n):1
Many(n): Many(n)
10. Data abstraction in DBMS, three levels of it
Ans:- the process of hiding certain details of DB from user is called abstraction.
Three Level of Data abstraction
View:- it is the highest level of abstraction and it describes only specific
part of database. At this level we have application programme which are
accessed by users according to data required.
logical:- it is the middle level of abstraction it describes what data is
stored and what their relationship. Programmers works at this level.
physical:- it is the lowest level of abstraction and it describes how data is
actually stored.
11. Indexing in DBMS
Ans:- Indexing in a DBMS speeds up data retrieval by creating a map that helps find
data quickly.
TYPES OF INDEXING :- ORDERED , CLUSTERED , PRIMARY , SECONDARY
I
NOTE:- SQL SERVER SUPPORT ONLY 2 TYPES
1)CLUSTER INDEX:- when a primary key is created automatically, a
clustered index is created, and it makes searching for a range of values faster. It is internally
maintained by a B-tree data structure, and you can create only one clustered index per table.
Syntax:- create clustered index index_name on table_name (col_name).
agar PK nahi hai toh jaise jis order mein hum insert karenge us order mein insert rahega
data tedha medha kaise bhi . agar hum cluster index wala query run krde toh sab short ho
jayega kisi particular col ke hlp se.
2) NON – CLUSTER INDEX:- when a unique key is created automatically, a
non-clustered index is created. and it makes searching for a range of values faster. It is ialso
maintained by a B-tree data structure. and you can create multiple non-clustered index per
table
12. What is DDL (Data Definition Language)
Ans:- it is a subset of SQL used for defining and managing the structure of a database ,
including
create, drop, alter, rename, truncate
13. What is DML (Data Manipulation Language)
Ans:- :- it is a subset of SQL used for interacting with and manipulating data within a
database , including
Insert, delete , update
14. What is normalization ? Types of them
Ans:- normalization is a step toward database optimization(distribute single table into
multiple tables) and it avoid data redundancy in database , not to store redundant data .
Types of normalization:- (BCNF , 4NF,5NF)
1NF:-
All element in the relation are atomic(individual value)(agey brkdown
nahi kr sakte)
And there is no repeating element or group of element
2NF
It is in 1st NF
No partial dependency exists between non-key attribute and key
attirubes.
3NF
It is in 2nd NF
no transitive dependency exists between non-key attributes and key attrib
utes through another non-key attributes
15. What is denormalization ?
Ans:- Denormalization is a database design technique that intentionally introduces
redundancy into a database by combining tables and data into single table to optimize its
performance.
16. What is functional dependency ?
Ans:- Functional dependency in a relational database occurs when the value of one
attribute uniquely determines or affect the value of another attribute in the same table.
Left side is known as determinant
Right side is known as dependent
17. E-R Model ?
Ans:- The E-R Model is like drawing a picture of what's in a database. It shows what
things (entities) are in the database, what facts (attributes) we want to know about them,
and how things are connected (relationships).
18. Conflict Serializability in DBMS .. (once get clear please)
19. What is CCP ? (Concurrency Control Protocols)
Ans:- Concurrency Control Protocols (CCP) are sets of rules and techniques used in
database management to ensure data consistency and isolation when multiple
transactions access data concurrently.
20. Entity, Entity Type, Entity Set, Weak Entity Set..
Ans:- Entity:- In a database management system (DBMS), an entity is a piece of data
that is stored in the database. An entity can be a person, place, thing, or even an event.
Doubt :- entity types tangible and intangible || strong Entity and weak Entity
Tangible Entity : Entities that exist in the real world physically. Example: Person, car, etc.
Intangible Entity : Entities that exist only logically and have no physical existence. Example:
Bank Account, etc.
Strong entity set:- A strong entity can stand alone because it has a unique identifier
(primary key) for each of its records.
Weak entity set:- A weak entity relies on a related strong entity for its identity and
cannot exist on its own.
21. What are SQL commands ? Types of them..
Ans:- same as SQl language
22. Nested Queries in SQL ?
Ans:- A subquery in a database is like a query within a query, used to find specific data
within a larger set of data.
23. What is JOIN .. Explain types of JOINs
Ans:- The SQL JOIN is a command clause that combines records from two or more tables in
a database.
Types of join (refer from book for venn diagram)
Inner join
Outer join -> right join , left join , full join(left join union right join)
24. Inner and Outer Join
Ans:- Inner join :- Typically used to retrieve data that exists in both tables.
OUTER JOIN:Returns all rows from one table and the matching rows from the other
[Link] rows from one table even if there is no match in the other table. Null
values are used for columns from the table with no match.
25. Diff between 2 tier and 3 tier architecture
26. Diff between TRUNCATE and DELETE command
Ans:- DROP: Deletes the entire table along with its structure
TRUNCATE: Deletes the entire table but not the structure
DELETE: Deletes the entire table but the changes are not saved until you perform
COMMIT. So basically, if any DDL command like DROP or TRUNCATE is executed
an auto COMMIT is performed but we have to explicitly run the COMMIT command
to save the changes permanently after we have executed a DML command.
27. Difference between Intension and Extension in a DataBase
Ans:- 'intension' to refer to the schema of a database like table name and name of it
s column .
it is not expected to change frequently .
it is permananet part of relation .
it is independent of time.
'extension' to refer to particular instances of a database list of all possible rows in a
table
It changes as tuples are created , destoyed and updated.
It is dependent with time.
f
NOTE:- refer syntax for code , cap theorem , Acid
properties , sharing , clustering from book or
youtube.
Compute Networks:
1. Define network
2. What do you mean by network topology, and explain types of them
3. Define bandwidth, node and link ?
4. Explain TCP model ..
5. Layers of OSI model
6. Significance of Data Link Layer
7. Define gateway, difference between gateway and router ..
8. What does ping command do ?
9. What is DNS, DNS forwarder, NIC, ?
10. What is MAC address ?
11. What is IP address, private IP address, public IP address, APIPA ?
12. Difference between IPv4 and IPv6
13. What is subnet ?
14. Firewalls
15. Different type of delays
16. 3 way handshaking
17. Server-side load balancer
18. RSA Algorithm
19. What is HTTP and HTTPS protocol ?
20. What is SMTP protocol ?
21. TCP and UDP protocol, prepare differences
22. What happens when you enter “[Link]” (very very famous question)
23. Hub vs Switch
24. VPN, advantages and disadvantages of it
25. LAN