0% found this document useful (0 votes)
21 views21 pages

Understanding Operating Systems and Components

An operating system (OS) manages computer hardware and software resources, providing essential services for programs. It includes various types such as Batch OS, Distributed OS, and Real-Time OS, among others. Key concepts covered include processes, threads, virtual memory, deadlocks, and scheduling algorithms like FCFS and SJF, along with an introduction to Database Management Systems (DBMS) and their advantages.

Uploaded by

Sahil Sachdeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views21 pages

Understanding Operating Systems and Components

An operating system (OS) manages computer hardware and software resources, providing essential services for programs. It includes various types such as Batch OS, Distributed OS, and Real-Time OS, among others. Key concepts covered include processes, threads, virtual memory, deadlocks, and scheduling algorithms like FCFS and SJF, along with an introduction to Database Management Systems (DBMS) and their advantages.

Uploaded by

Sahil Sachdeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OPerating System

1. What is the main purpose of an operating system? Discuss different types?


An operating system (OS) is system software that manages computer hardware,
software resources, and provides common services for computer programs. So it
manages the computer’s memory, processes, devices, files, and security aspects of
the system. It also allows us to communicate with the computer without knowing how
to speak the computer’s language. Without an operating system, a computer is not
useful.
Types of operating system:
●Batch OS
●Distributed OS
●Multitasking OS
●Network OS
●Real-Time OS
●Mobile OS
●Mobile OS
1. What is a socket, kernel and monolithic kernel ?
Socket:
A socket is defined as an endpoint for communication, A pair of processes
communicating over a network employ a pair of sockets ,one for each process. A
socket is identified by an IP address concatenated with a port number.
The server waits for incoming client requests by listening to a specified port. Once a
request is received, the server accepts a connection from the client socket to
complete the connection.
Kernel is the central core component of an operating system that manages
operations of computer and hardware. Kernel Establishes communication between
user level application and hardware. Manages memory and CPU time. Decides state
of incoming processes. Controls Disk, Memory, Task Management
Monolithic Kernel (provides good performance but lots of lines of code)
It is one of the types of kernel where all operating system services operate in kernel
space. It has dependencies between system components. It has huge lines of code
which is complex.
Example : Unix, Linux, Open VMS, XTS-400 etc.
2. Difference between process and program and thread? Different types of process.
Process:
Process is an instance of an executing program. For example, we write our computer
programs in a text file and when we execute this program, it becomes a process
which performs all the tasks mentioned in the program.
Program:
Program is a set of instructions to perform a certain task. Eg: [Link],
[Link]
Thread:
Thread is a path of execution within a process. A thread is also known as a
lightweight process. The idea is to achieve parallelism by dividing a process into
multiple threads. For example,Word processor uses multiple threads: one thread to
format the text, another thread to process inputs.
3. Define virtual memory, thrashing, threads.
Virtual Memory:
A computer can address more memory than the amount physically installed on the
system. This extra memory is actually called virtual memory and it is a section of a
hard disk that’s set up to emulate the computer’s RAM.
The main visible advantage of this scheme is that programs can be larger than
physical memory. Virtual memory serves two purposes. First, it allows us to extend
the use of physical memory by using a disk. Second, it allows us to have memory
protection, because each virtual address is translated to a physical address.
Thrashing:
Thrashing is a condition or a situation when the system is spending a major portion of
its time in servicing the page faults, but the actual processing done is very negligible.
High degree of multiprogramming(if number of processes keeps on increasing in the
memory), lack of frames (if a process is allocated too few frames, then there will be
too many and too frequent page faults) causes Thrashing.
Threads:
A thread is a single sequential flow of execution of tasks of a process so it is also
known as thread of execution or thread of control.
4. What is RAID ? Different types.
RAID, or “Redundant Arrays of Independent Disks” is a technique which makes use
of a combination of multiple disks instead of using a single disk for increased
performance, data redundancy or [Link] redundancy, although taking up extra
space, adds to disk reliability. This means, in case of disk failure, if the same data is
also backed up onto another disk, we can retrieve the data and go on with the
operation.
5. What is a deadlock? Different conditions to achieve a deadlock.
A Deadlock is a situation where each of the computer processes waits for a resource
which is being assigned to some other process. In this situation, none of the
processes gets executed since the resource it needs is held by some other process
which is also waiting for some other resource to be released.
How deadlock is achieved: Deadlock happens when Mutual exclusion, hold and wait,
No preemption and circular wait occurs simultaneously.
Necessary Conditions for deadlock:
[Link] Exclusion
[Link] and Wait
[Link] preemption
[Link] Wait
6. What is fragmentation? Types of fragmentation.
Fragmentation:
An unwanted problem in the operating system in which the processes are loaded and
unloaded from memory, and free memory space is fragmented. Processes can’t be
assigned to memory blocks due to their small size, and the memory blocks stay
unused. It is also necessary to understand that as programs are loaded and deleted
from memory, they generate free space or a hole in the memory. These small blocks
cannot be allotted to new arriving processes, resulting in inefficient memory use.
The conditions of fragmentation depend on the memory allocation system. As the
process is loaded and unloaded from memory, these areas are fragmented into small
pieces of memory that cannot be allocated to incoming processes. It is called
fragmentation.
Types of fragmentation:
1. Internal
2. External
7. What is spooling ?
SPOOL is an acronym for simultaneous peripheral operations online. Spooling is a
process in which data is temporarily held to be used and executed by a device,
program, or system.
In spooling, there is no interaction between the I/O devices and the CPU. That
means there is no need for the CPU to wait for the I/O operations to take place. Such
operations take a long time to finish executing, so the CPU will not wait for them to
finish.
The biggest example of Spooling is printing. The documents which are to be printed
are stored in the SPOOL and then added to the queue for printing. During this time,
many processes can perform their operations and use the CPU without waiting while
the printer executes the printing process on the documents one-by-one.
8. Belady’s Anomaly
Bélády’s anomaly is the name given to the phenomenon where increasing the
number of page frames results in an increase in the number of page faults for a given
memory access pattern.

Solution to fix Belady’s Anomaly:


Implementing alternative page replacement algo helps eliminate Belady’s Anomaly..
Use of stack based algorithms, such as Optimal Page Replacement Algorithm and
Least Recently Used (LRU) algorithm, can eliminate the issue of increased page
faults as these algorithms assign priority to pages

9. Starving and Aging in OS


Starving/Starvation(also called Lived lock): Starvation is the problem that occurs
when low priority processes get jammed for an unspecified time as the high priority
processes keep executing. So starvation happens if a method is indefinitely delayed.

Solution to Starvation : Ageing is a technique of gradually increasing the priority of


processes that wait in the system for a long time.

10. Why does trashing occur?


High degree of multiprogramming(if number of processes keeps on increasing in the
memory) , lack of frames(if a process is allocated too few frames, then there will be
too many and too frequent page faults.) causes Thrashing.

11. What is paging and why do we need it?


Paging is a memory management scheme that eliminates the need for contiguous
allocation of physical memory. This scheme permits the physical address space of a
process to be non – contiguous.
Paging is used for faster access to data. When a program needs a page, it is
available in the main memory(RAM) as the OS copies a certain number of pages
from your storage device to main memory. Paging allows the physical address space
of a process to be noncontiguous.

Demand Paging, Segmentation


Demand paging is a method of virtual memory management which is based on the
principle that pages should only be brought into memory if the executing process
demands them. This is often referred to as lazy evaluation as only those pages
demanded by the process are swapped from secondary storage to main memory.
So demand paging works opposite to the principle of loading all pages immediately.

Segmentation is a memory management technique in which the memory is divided


into the variable size parts. Each part is known as a segment which can be allocated
to a process.

The details about each segment are stored in a table called a segment table.
Segment table is stored in one (or many) of the segments.

Segment table contains mainly two information about segment:

Base: It is the base address of the segment


Limit: It is the length of the segment.

12. Real Time Operating System, types of RTOS.


A real-time operating system (RTOS) is a special-purpose operating system used in
computers that has strict time constraints for any job to be performed and is intended
to serve real time applications that possess data as it comes in , typically without
buffer delays.

Types of RTOS:

Hard RTOS
Firm RTOS
Soft RTOS

13. Difference between main memory and secondary memory.


Attribute Main Memory (RAM) Secondary Memory (e.g., HDD, SSD)
Volatility Volatile - Loses data when power is turned off Non-volatile - Retains data even when power is off
Speed Faster access times Slower access times compared to RAM
Capacity Smaller capacity Larger capacity than RAM
Cost More expensive per unit of storage Generally less expensive per unit of storage
Type of Stores currently executing programs and data Stores data and programs for the long term
Data
Accessibility Directly accessed by the CPU for quick operations Accessed by the CPU for long-term storage
Purpose Used for temporary storage during program execution Used for long-term storage of data and programs
Examples DDR4, DDR5 RAM Hard Disk Drives (HDDs), Solid State Drives (SSDs)

14. Dynamic Binding


Static binding happens when the code is compiled, while dynamic bind happens
when the code is executed at run time.

15. Static Binding:


When a compiler acknowledges all the information required to call a function or all
the values of the variables during compile time, it is called “static binding”. As all the
required information is known before runtime, it increases the program efficiency and
it also enhances the speed of execution of a program. Static Binding makes a
program very efficient, but it declines the program flexibility, as ‘values of variable’
and ‘function calling’ are predefined in the program. Static binding is implemented in
a program at the time of coding. Overloading a function or an operator is the example
of compile time polymorphism i.e. static binding.

Dynamic Binding Calling a function or assigning a value to a variable, at run-time is


called “Dynamic Binding”. Dynamic binding can be associated with run time
‘polymorphism’ and ‘inheritance’ in OOP. Dynamic binding makes the execution of a
program flexible as it can decide what value should be assigned to the variable and
which function should be called, at the time of program execution. But as this
information is provided at run time it makes the execution slower as compared to
static binding.

16. FCFS Scheduling

FCFS (First-Come-First-Serve) Scheduling is a simple scheduling algorithm used in


operating systems. In FCFS, the process that arrives first is the one that gets
executed first. It follows the principle of "first come, first served." Here are some key
points about FCFS scheduling:
 Order of Execution: Processes are executed in the order they arrive in the ready
queue. The process that arrives first is the one that gets executed first.
 Non-preemptive: Once a process starts its execution, it continues until it
completes. Preemption (interrupting a currently running process) does not occur
in FCFS.
 Queue: Processes waiting in the ready queue are served on a first-come-first-
served basis.

17. SJF Scheduling


SJF (Shortest Job First) Scheduling is a scheduling algorithm used in operating
systems to minimize the total processing time. In SJF scheduling, the process with
the shortest burst time is the next to execute. Here are key points about SJF
scheduling:
 Execution Order: Processes are scheduled based on the length of their next
CPU burst. The process with the shortest burst time is selected for execution first.
 Preemptive and Non-preemptive: SJF can be either preemptive or non-
preemptive.
 Non-preemptive (SJF): Once a process starts its execution, it continues until
completion.
 Preemptive (SRTF - Shortest Remaining Time First): If a new process arrives
with a shorter burst time than the remaining time of the currently executing
process, the current process is preempted, and the new process is scheduled.

Advantages:
 Minimizes waiting time and turnaround time for processes.
 Efficient in terms of average waiting time.
Disadvantages:
 Can lead to starvation for longer processes if short processes keep arriving.
 Predicting exact burst times is challenging.

18. SRTF Scheduling


SRTF Scheduling is a preemptive version of SJF scheduling. In SRTF, the execution
of the process can be stopped after a certain amount of time. At the arrival of every
process, the short term scheduler schedules the process with the least remaining
burst time among the list of available processes and the running process.

19. LRTF Scheduling


This is a preemptive version of Longest Job First (LJF) scheduling algorithm. In this
scheduling algorithm, we find the process with the maximum remaining time and then
process it. We check for the maximum remaining time after some interval of time(say
1 unit each) to check if another process having more Burst Time arrived up to that
time.

20. Priority Scheduling


Priority Scheduling is a method of scheduling processes that is based on priority. In
this algorithm, the scheduler selects the tasks to work as per the priority.

The processes with higher priority should be carried out first, whereas jobs with equal
priorities are carried out on a round-robin or FCFS basis. Priority depends upon
memory requirements, time requirements, etc.

21. Round Robin Scheduling


In Round-robin scheduling, each ready task runs turn by turn only in a cyclic queue
for a limited time slice. This algorithm also offers starvation free execution of
processes. Widely used preemptive scheduling method in traditional OS. All the jobs
get a fair allocation of CPU. Cons include : Finding a correct time quantum is a quite
difficult task in this system, Round-robin scheduling doesn’t give special priority to
more important tasks.

22. Producer Consumer Problem


About Producer-Consumer problem: The Producer-Consumer problem is a classic
problem that is used for multi-process synchronisation i.e. synchronisation between
more than one processes.

The job of the Producer is to generate the data, put it into the buffer, and again start
generating data. While the job of the Consumer is to consume the data from the
buffer.

23. What’s the problem here?


The following are the problems that might occur in the Producer-Consumer:

The producer should produce data only when the buffer is not full. If the buffer is full,
then the producer shouldn’t be allowed to put any data into the buffer.
The consumer should consume data only when the buffer is not empty. If the buffer is
empty, then the consumer shouldn’t be allowed to take any data from the buffer.
The producer and consumer should not access the buffer at the same time.

We can solve this problem by using semaphores.

24. Banker’s Algorithm


It is a banker algorithm used to avoid deadlock and allocate resources safely to each
process in the computer system. The ‘S-State’ examines all possible tests or
activities before deciding whether the allocation should be allowed to each process. It
also helps the operating system to successfully share the resources between all the
processes. The banker’s algorithm is named because it checks whether a person
should be sanctioned a loan amount or not to help the bank system safely simulate
allocation resources.

25. Explain Cache


Cache memory is an extremely fast memory type that acts as a buffer between RAM
and the CPU. It holds frequently requested data and instructions so that they are
immediately available to the CPU when needed.

26. Diff between direct mapping and associative mapping


27. Diff between multitasking and multiprocessing

Database Management System:

28. What is DBMS ? Mention advantages..


Database Management System (DBMS) is a software for storing and retrieving users’
data while considering appropriate security measures. It consists of a group of
programs which manipulate the database. The DBMS accepts the request for data
from an application and instructs the operating system to provide the specific data. In
large systems, a DBMS helps users and other third-party software to store and
retrieve data.

Advantages:

Improved data sharing


Improved data security
Better data integration
Minimised data inconsistency
Improved data access
Improved decision making
Improved end-user productivity
29. What is Database?
A database is an organised collection of structured information, or data, typically
stored electronically in a computer system. A database is usually controlled by a
database management system (DBMS). Together, the data and the DBMS, along
with the applications that are associated with them, are referred to as a database
system, often shortened to just a database.

30. What is a database system?

31. What is RDBMS ? Properties..


A Relational Database Management system (RDBMS) is a database management
system that is based on the relational model. It has the following major components:
Table, Record/Tuple/Row, Field, and Column/Attribute. Examples of the most
popular RDBMS are MYSQL, Oracle, IBM DB2, and Microsoft SQL Server database.

Relational databases have the following properties:

 Values are atomic.


 All of the values in a column have the same data type.
 Each row is unique.
 The sequence of columns is insignificant.
 The sequence of rows is insignificant.
 Each column has a unique name.
 Integrity constraints maintain data consistency across multiple tables.

Types of database languages


 Data Definition Language: DDL stands for Data Definition Language. It is used
to define database structure or pattern.
 Data Manipulation Language: DML stands for Data Manipulation Language. It
is used for accessing and manipulating data in a database. It handles user
requests.
 Data Control Language: DCL stands for Data Control Language. It is used to
retrieve the stored or saved data.
 Transaction Control Language: TCL is used to run the changes made by the
DML statement. TCL can be grouped into a logical transaction.
ACID properties (VVVVV IMP)
To ensure the consistency of the database, certain properties are followed by all the
transactions occurring in the system.
These properties are called ACID Properties of a transaction.

Atomicity
Consistency
Isolation
Durability

1. Difference between vertical and horizontal scaling


Scaling alters the size of a system. In the scaling process, we either compress or
expand the system to meet the expected needs. The scaling operation can be
achieved by adding resources to meet the smaller expectation in the current system,
or by adding a new system in the existing one, or both.

Vertical scaling keeps your existing infrastructure but adds computing power. Your
existing pool of code does not need to change — you simply need to run the same
code on machines with better specs. By scaling up, you increase the capacity of a
single machine and increase its throughput. Vertical scaling allows data to live on a
single node, and scaling spreads the load through CPU and RAM resources for your
machines.

Horizontal scaling simply adds more instances of machines without first implementing
improvements to existing specifications. By scaling out, you share the processing
power and load balancing across multiple machines.

Attribute Vertical Scaling Horizontal Scaling


Definition Adding more resources (CPU, RAM) to a Adding more machines to distribute the load
single machine

Hardware Relies on more powerful hardware Relies on multiple, less powerful hardware instances
Dependency

Flexibility Limited scalability due to hardware More flexible and scalable


constraints
Cost Generally more expensive as high-end Can be cost-effective as commodity hardware is used
hardware is costly

Downtime Impact Downtime may be required for upgrading Minimal downtime as new machines can be added on the fly
hardware

Resource May lead to inefficient use of resources if Efficient utilization as load can be distributed across machines
Utilization the load is not evenly distributed

Fault Tolerance Less fault-tolerant, as a failure can impact More fault-tolerant, as failure of one machine affects only a portion of
the entire system the system

2. What is sharding
Sharding is a method of splitting and storing a single logical dataset in multiple
databases. By distributing the data among multiple machines, a cluster of database
systems can store larger dataset and handle additional requests. Sharding is
necessary if a dataset is too large to be stored in a single database. Moreover, many
sharding strategies allow additional machines to be added. Sharding allows a
database cluster to scale along with its data and traffic growth.

3. Keys in DBMS
A key is a set of attributes that can identify each tuple uniquely in the given relation.

Types of Keys:

Super Key – A superkey is a set of attributes that can identify each tuple uniquely in
the given relation. A super key may consist of any number of attributes.
Candidate Key – A set of minimal attribute(s) that can identify each tuple uniquely in
the given relation is called a candidate key.
Primary Key – A primary key is a candidate key that the database designer selects
while designing the database. Primary Keys are unique and NOT NULL.
Alternate Key – Candidate keys that are left unimplemented or unused after
implementing the primary key are called alternate keys.
Foreign Key – An attribute ‘X’ is called as a foreign key to some other attribute ‘Y’
when its values are dependent on the values of attribute ‘Y’. The relation in which
attribute ‘Y’ is present is called the referenced relation. The relation in which attribute
‘X’ is present is called the referencing relation.
Composite Key – A primary key composed of multiple attributes and not just a
single attribute is called a composite key.
Unique Key – It is unique for all the records of the table. Once assigned, its value
cannot be changed i.e. it is non-updatable. It may have a NULL value.

4. Types of relationship
A relationship is defined as an association among several entities.

Unary Relationship Set – Unary relationship set is a relationship set where only one
entity set participates in a relationship set.
Binary Relationship Set – Binary relationship set is a relationship set where two
entity sets participate in a relationship set.
Ternary Relationship Set – Ternary relationship set is a relationship set where three
entity sets participate in a relationship set.
N-ary Relationship Set – N-ary relationship set is a relationship set where ‘n’ entity
sets participate in a relationship set.

5. Data abstraction in DBMS, three levels of it


Data Abstraction is a process of hiding unwanted or irrelevant details from the end
user. It provides a different view and helps in achieving data independence which is
used to enhance the security of data.

Database systems include complex data-structures. In terms of retrieval of data,


reduce complexity in terms of usability of users and in order to make the system
efficient, developers use levels of abstraction that hide irrelevant details from the
users. Levels of abstraction simplify database design.
Indexing in DBMS
Indexing is a way to optimise the performance of a database by minimising the
number of disk accesses required when a query is processed. It is a data structure
technique which is used to quickly locate and access the data in a database.

6. What is DDL (Data Definition Language)


DDL stands for Data Definition Language. It is used to define database structure or
pattern.
It is used to create schema, tables, indexes, constraints, etc. in the database.
Using the DDL statements, you can create the skeleton of the database.
Data definition language is used to store the information of metadata like the number
of tables and schemas, their names, indexes, columns in each table, constraints, etc.

7. What is DML (Data Manipulation Language)


DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.

8. What is normalization ? Types of normalization.


Normalization is the process of organizing data by disintegrating bigger table into
smaller one’s with proper dependencies
Redundant Data wastes a lot of disk space and creates maintenance problems
(Update, Insert and Delete Anomaly). Hence the DB tables should be Normalized.
The process of Normalization is achieved by following some rules which are defined
as Normal Forms
There are basically 3 types of Normal Form – 1NF, 2NF, 3NF. Strictness increases
as we go from 1NF to 3NF.
Apart from the above mentioned Normal Form there exist one more Form called
Boyce Codd Normal Form (BCNF) . This is an advanced version of 3NF and is even
stricter than 3NF.
Read normalisation in details

9. What is denormalization ?
Denormalization is a database optimization technique in which we add redundant
data to one or more tables. This can help us avoid costly joins in a relational
database. Note that denormalization does not mean not doing normalisation. It is an
optimization technique that is applied after doing normalisation.

10. What is functional dependency ?


A functional dependency is a constraint that specifies the relationship between two
sets of attributes where one set can accurately determine the value of other sets. It is
denoted as X → Y, where X is a set of attributes that is capable of determining the
value of Y. The attribute set on the left side of the arrow, X is called Determinant,
while on the right side, Y is called the Dependent.

11. E-R Model ?


ER model stands for an Entity-Relationship model. It is a high-level data model. This
model is used to define the data elements and relationship for a specified system.
It develops a conceptual design for the database. It also develops a very simple and
easy to design view of data.
In ER modelling, the database structure is portrayed as a diagram called an entity-
relationship diagram.

12. Conflict Serializability in DBMS ..


Serializability is a concept that helps us to check which schedules are serializable. A
serializable schedule is the one that always leaves the database in consistent state.

A schedule is called conflict serializability if after swapping of non-conflicting


operations, it can transform into a serial schedule. The schedule will be a conflict
serializable if it is conflict equivalent to a serial schedule.

13. What is CCP ? (Concurrency Control Protocols)


Concurrency Control is the management procedure that is required for controlling
concurrent execution of the operations that take place on a database.

The concurrency control protocols ensure the atomicity, consistency, isolation,


durability and serializability of the concurrent execution of the database transactions.

Therefore, these protocols are categorised as:

Lock Based Concurrency Control Protocol


Timestamp Concurrency Control Protocol
Validation Based Concurrency Control Protocol
Entity, Entity Type, Entity Set, Weak Entity Set..
Entity in DBMS can be a real-world object with an existence, For example, in a
College database, the entities can be Professor, Students, Courses, etc.

The entity type is a collection of the entity having similar attributes.

Types of Entity type:

Strong Entity Type:Strong entities are those entity types which have a key attribute.
The primary key helps in identifying each entity uniquely. It is represented by a
rectangle.
Weak Entity Type: Weak entity type doesn’t have a key attribute. Weak entity types
can’t be identified on their own. It depends upon some other strong entity for its
distinct identity.
Entity Set: Entity Set is a collection of entities of the same entity type. We can say
that entity type is a superset of the entity set as all the entities are included in the
entity type.

 What are SQL commands ? Types of them..


[Link]

Nested Queries in SQL ?


[Link]

What is JOIN .. Explain types of JOINs


[Link]

Inner and Outer Join


Here are the different types of the JOINs in SQL:

(INNER) JOIN: Returns records that have matching values in both tables
LEFT (OUTER) JOIN: Returns all records from the left table, and the matched
records from the right table
RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched
records from the left table
FULL (OUTER) JOIN: Returns all records when there is a match in either left or right
table

1. Diff between 2 tier and 3 tier architecture


Attribute 2-Tier Architecture 3-Tier Architecture
Number of Two tiers - Client and Database Server Three tiers - Presentation, Application, and
Tiers Database Server

Responsibilitie Client responsible for the presentation and Presentation, Business Logic, and Data
s business logic; Database Server for data Management are distributed across separate
storage and retrieval tiers
Scalability Limited scalability, as scaling involves More scalable, as each tier can be scaled
upgrading the client or database server independently

Flexibility Less flexible, as changes in one tier may affect More flexible, as changes in one tier have less
the other impact on the others

Maintenance Easier to maintain, as there are fewer Maintenance is more modular and isolated due to
components separate tiers
Network Traffic Higher network traffic between client and server Reduced network traffic, as business logic and
due to combined business logic and data data access are distributed
access
Security Security is often handled at the client and Enhanced security, as access control and data
database server levels management can be enforced at the application
server layer

2. Diff between TRUNCATE and DELETE command

Attribute TRUNCATE Command DELETE Command


Operation DDL (Data Definition Language) DML (Data Manipulation Language)

Permission Requires the DROP privilege on the table Requires DELETE privilege on the table
Requirement
Transaction Not logged individually (minimal logging) Logged individually (full logging)

Rollback Cannot be rolled back Can be rolled back using the ROLLBACK
command
Conditions Does not allow WHERE clause Allows WHERE clause to specify conditions

Performance Generally faster, especially for large Slower, especially for large tables with many
Attribute TRUNCATE Command DELETE Command
tables conditions

Locks Obtains a table-level lock during the Can use row-level locks depending on conditions
operation
Reset Identity Resets identity columns, if applicable Does not automatically reset identity columns
Column
Triggers Does not activate DELETE triggers Activates DELETE triggers (if defined)

Use Cases Suitable for quickly removing all rows Used when conditions need to be specified for
from a table row deletion
Example TRUNCATE TABLE TableName; DELETE FROM TableName WHERE
Condition;

3. Difference between Intension and Extension in a DataBase


Attribute Intension Extension
Definition Describes the schema or structure of the database, Represents the actual data stored in the
including data types, constraints, relationships, and rules database at a specific point in time

Nature Static, relatively constant over time Dynamic, changes as data is added,
modified, or deleted

Representatio Conceptual representation of the database schema Instantaneous snapshot of the data in the
n database

Examples Data definition language (DDL) statements, schema Rows and columns of data in the tables
diagrams
Modification Altered through DDL statements (e.g., ALTER TABLE) Altered through DML statements (e.g.,
INSERT, UPDATE, DELETE)

Purpose Defines the structure and organization of the database Represents the actual instances of data
stored in the database

Focus Focuses on the metadata and database design Focuses on the actual data values

Stability Relatively stable, changes infrequently Constantly changing as data is


manipulated
Querying Not queried directly; used for database design and Directly queried to retrieve, update, or
schema definition manipulate data
Example SQL CREATE TABLE, ALTER TABLE SELECT, INSERT, UPDATE, DELETE

4. Difference between share lock and exclusive lock, definition of lock

Attribute Lock Definition Share Lock Exclusive Lock


Definition A lock is a synchronization A share lock allows multiple An exclusive lock allows only
mechanism used to control transactions to read the one transaction to have
access to a resource in a multi- resource simultaneously, but it access to the resource,
user environment, preventing prevents any of them from preventing any other
conflicts and ensuring data obtaining an exclusive lock. transactions (read or write)
consistency. from acquiring a lock.
Intent Used to control access and Indicates that the transaction Indicates that the transaction
coordinate activities among holding the lock is interested holding the lock is interested
concurrent transactions. in reading the resource. in writing to the resource.
Attribute Lock Definition Share Lock Exclusive Lock
Concurrenc Supports a higher level of Reduces concurrency, as only Exclusive locks are more
y concurrency, as multiple one transaction can hold an restrictive to prevent conflicts
transactions can hold share exclusive lock at a time. during writes.
locks simultaneously.
Conflicts Share locks do not conflict with Exclusive locks conflict with Exclusive locks are more
other share locks, but conflict both share and exclusive restrictive to prevent conflicts
with exclusive locks. locks, preventing multiple during writes.
transactions from acquiring
conflicting locks
simultaneously.
Acquisition Acquired using the LOCK Acquired with the intent to Acquired with the intent to
statement or equivalent read the resource without modify the resource,
mechanisms in database modifying it. preventing other transactions
systems. from reading or writing
concurrently.
Release Released explicitly by the Released when the transaction Released when the
transaction when it no longer holding the lock either transaction holding the lock
needs the lock, or automatically commits or rolls back. either commits or rolls back.
at the end of the transaction.
Example LOCK TABLE table_name IN LOCK TABLE table_name -
SQL
SHARE MODE; IN EXCLUSIVE MODE;

Computer Networks

5. Define network
A network is a set of devices that are connected with a physical media link. In
a network, two or more nodes are connected by a physical link or two or more
networks are connected by one or more nodes. A network is a collection of devices
connected to each other to allow the sharing of data.

6. What do you mean by network topology, and explain types of them


Network topology is the arrangement of nodes and links of a network.
Topologies are categorized as either physical network topology or logical network
topology.
The topology of a network is key to determining its performance.
Network topology can be categorized into – Bus Topology, Ring Topology, Star
Topology, Mesh Topology, Tree Topology.
Read this article for more details.

7. Define bandwidth, node and link ?


Bandwidth is the data transfer capacity of a computer network in bits per second
(Bps). The term may also be used colloquially to indicate a person’s capacity for
tasks or deep thoughts at a point in time.

A network is a connection setup of two or more computers directly connected by


some physical mediums like optical fibre or coaxial cable. This physical medium of
connection is known as a link, and the computers that it is connected to are known as
nodes

8. Explain TCP model ..


It is a compressed version of the OSI model with only 4 layers. It was developed by
the US Department of Defence (DoD) in the 1860s. The name of this model is based
on 2 standard protocols used i.e. TCP (Transmission Control Protocol) and IP
(Internet Protocol).

1. Network Access/Link layer : Decides which links such as serial lines or classic
Ethernet must be used
to meet the needs of the connectionless internet layer. Ex – Sonet, Ethernet
2. Internet : The internet layer is the most important layer which holds the whole
architecture together. It delivers the IP packets where they are supposed to be
delivered. Ex – IP, ICMP.
3. Transport : Its functionality is almost the same as the OSI transport layer. It
enables peer entities on the network to carry on a conversation. Ex – TCP, UDP
(User Datagram Protocol)
4. Application : It contains all the higher-level protocols. Ex – HTTP, SMTP, RTP,
DNS

Layers of OSI model


There are majorly 2 main layers in the OSI model:
Physical Layer
Data Link Layer
Read this article for details

9. Significance of Data Link Layer


Define gateway, difference between gateway and router ..
A node that is connected to two or more networks is commonly known as a gateway.
It is also known as a router. It is used to forward messages from one network to
another. Both the gateway and router regulate the traffic in the network. Differences
between gateway and router: A router sends the data between two similar networks
while gateway sends the data between two dissimilar networks.

10. What does ping command do ?


The “ping” is a utility program that allows you to check the connectivity between the
network devices. You can ping devices using its IP address or name.

11. What is DNS, DNS forwarder, NIC, ?


DNS:
1. DNS is an acronym that stands for Domain Name [Link] was introduced by
Paul Mockapetris and Jon Postel in 1983.
2. It is a naming system for all the resources over the internet which includes physical
nodes and applications. It is used to locate resources easily over a network.
3. DNS is an internet which maps the domain names to their associated IP
addresses.
4. Without DNS, users must know the IP address of the web page that you wanted to
access.

DNS Forwarder : A forwarder is used with a DNS server when it receives DNS
queries that cannot be resolved quickly. So it forwards those requests to external
DNS servers for resolution. A DNS server which is configured as a forwarder will
behave differently than the DNS server which is not configured as a forwarder. NIC
stands for Network Interface Card. It is a peripheral card attached to the PC to
connect to a network. Every NIC has its own MAC address that identifies the PC on
the network. It provides a wireless connection to a local area network. NICs were
mainly used in desktop computers.

12. What is MAC address ?


A media access control address (MAC address) is a unique identifier assigned to a
network interface controller (NIC) for use as a network address in communications
within a network segment.

13. What is IP address, private IP address, public IP address, APIPA ?


An IP address is a unique address that identifies a device on the internet or a local
network. IP stands for “Internet Protocol,” which is the set of rules governing the
format of data sent via the internet or local network.

Private IP Address – There are three ranges of IP addresses that have been
reserved
for IP addresses. They are not valid for use on the internet. If you want to access the
internet on these private IPs, you must use a proxy server or NAT server.

Public IP Address – A public IP address is an address taken by the Internet Service


Provider which facilitates communication on the internet.

14. APIPA stands for Automatic Private IP Addressing (APIPA).


It is a feature or characteristic in operating systems (eg. Windows) which enables
computers to self-configure an IP address and subnet mask automatically when their
DHCP(Dynamic Host Configuration Protocol:A DHCP Server is a network server that
automatically provides and assigns IP addresses, default gateways and other
network parameters to client devices. It relies on the standard protocol known as
Dynamic Host Configuration Protocol) server isn’t reachable

15. Difference between IPv4 and IPv6


Attribute IPv4 IPv6
Address Length 32 bits (4 bytes) 128 bits (16 bytes)
Attribute IPv4 IPv6
Notation Dotted-decimal format (e.g., Hexadecimal notation separated by colons (e.g.,
[Link]) [Link])
Address Space Limited (2^32 or Vast (2^128 or approximately 3.4x10^38 addresses)
approximately 4.3 billion
addresses)
Address Manual or DHCP (Dynamic Stateless Address Autoconfiguration (SLAAC) or DHCPv6
Configuration Host Configuration Protocol)
Broadcast Supported (broadcast Not supported; multicast used instead
addresses like
[Link])
Network Classes Classful addressing (Class A, Abolished; no network classes in IPv6
B, C, D, E)
Subnetting Subnetting is common and Subnetting is still possible but less emphasized
often required
Header Length Fixed header length (20 Fixed and extended header lengths (40 bytes minimum)
bytes)
Checksum Includes a checksum field in Checksum is removed, and error checking is handled at
the header higher layers (e.g., through ICMPv6)
NAT (Network Commonly used due to Less reliance on NAT due to a larger address space
Address limited address space
Translation)
ARP (Address Uses ARP to map IP ARP is replaced by ICMPv6's Neighbor Discovery
Resolution addresses to MAC addresses Protocol (NDP)
Protocol)
Security Features Limited security features Enhanced security features, including IPsec support

Transition Several transition Transition mechanisms still used but less complex due to
Mechanisms mechanisms, such as Dual widespread IPv6 support
Stack and tunneling

16. What is subnet ?


A subnet is a network inside a network achieved by the process called subnetting
which helps divide a network into subnets. It is used for getting a higher routing
efficiency and enhances the security of the network. It reduces the time to extract the
host address from the routing table.

17. Firewalls
The firewall is a network security system that is used to monitor the incoming
and outgoing traffic and blocks the same based on the firewall security policies. It
acts as a wall between the internet (public network) and the networking devices (a
private network). It is either a hardware device, software program, or a combination
of both. It adds a layer of security to the network.

18. Different type of delays


The delays, here, means the time for which the processing of a particular packet
takes place.

We have the following types of delays in computer networks:


Transmission Delay
Propagation delay
Queueing delay
Processing delay
3 way handshaking
Three-Way HandShake or a TCP 3-way handshake is a process which is used in a
TCP/IP network to make a connection between the server and client. It is a three-
step process that requires both the client and server to exchange synchronisation
and acknowledgment packets before the real data communication process starts.

Three-way handshake process is designed in such a way that both ends help you to
initiate, negotiate, and separate TCP socket connections at the same time. It allows
you to transfer multiple TCP socket connections in both directions at the same time.

19. Server-side load balancer


All backend server instances are registered with a central load balancer. A client
requests this load balancer which then routes the request to one of the server
instances using various algorithms like round-robin. AWS ELB(Elastic Load
Balancing) is a prime example of server-side load-balancing that registers multiple
EC2 instances launched in its auto-scaling group and then routes the client requests
to one of the EC2 instances.

20. Advantages of server-side load balancing:

Simple client configuration: only need to know the load-balancer address.


Clients can be untrusted: all traffic goes through the load-balancer where it can be
looked at. Clients are not aware of the backend servers.

21. RSA Algorithm


RSA algorithm is an asymmetric cryptography algorithm. Asymmetric actually means
that it works on two different keys i.e. Public Key and Private Key. As the name
describes, the Public Key is given to everyone and the Private key is kept private.

An example of asymmetric cryptography : A client (for example browser) sends its


public key to the server and requests for some data. The server encrypts the data
using the client’s public key and sends the encrypted data. Client receives this data
and decrypts it. Since this is asymmetric, nobody else except the browser can
decrypt the data even if a third party has the public key of the browser.

22. What is HTTP and HTTPS protocol ?


HTTP is the HyperText Transfer Protocol which defines the set of rules and
standards on how the information can be transmitted on the World Wide Web
(WWW). It helps the web browsers and web servers for communication. It is a
‘stateless protocol’ where each command is independent with respect to the previous
command. HTTP is an application layer protocol built upon the TCP. It uses port 80
by default. HTTPS is the HyperText Transfer Protocol Secure or Secure HTTP. It is
an advanced and a secured version of HTTP. On top of HTTP, SSL/TLS protocol is
used to provide security. It enables secure transactions by encrypting the
communication and also helps identify network servers securely. It uses port 443 by
default.

23. What is SMTP protocol ?


SMTP is the Simple Mail Transfer Protocol. SMTP sets the rule for communication
between servers. This set of rules helps the software to transmit emails over the
internet. It supports both End-to-End and Store-and-Forward methods. It is in always-
listening mode on port 25.

24. TCP and UDP protocol, prepare differences


TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol. A
key difference between TCP and UDP is speed, as TCP is comparatively slower than
UDP. Overall, UDP is a much faster, simpler, and
efficient protocol, however, retransmission of lost data packets is only possible with
TCP.

TCP provides extensive error checking mechanisms. It is because it provides flow


control and acknowledgment of data. UDP has only the basic error checking
mechanism using checksums.

25. What happens when you enter “[Link]” (very very famous question)
Check the browser cache first if the content is fresh and present in the cache display
the same.
If not, the browser checks if the IP of the URL is present in the cache (browser and
OS) if not then requests the OS to do a DNS lookup using UDP to get the
corresponding IP address of the URL from the DNS server to establish a new TCP
connection.
A new TCP connection is set between the browser and the server using three-way
handshaking.
An HTTP request is sent to the server using the TCP connection.
The web servers running on the Servers handle the incoming HTTP request and
send the HTTP response.
The browser processes the HTTP response sent by the server and may close the
TCP connection or reuse the same for future requests.
If the response data is cacheable then browsers cache the same.
Browser decodes the response and renders the content.

26. Hub vs Switch


Hub: Hub is a networking device which is used to transmit the signal to each port
(except one port) to respond from which the signal was received. Hub is operated on
a Physical layer. In this packet filtering is not available. It is of two types: Active Hub,
Passive Hub.

Switch: Switch is a network device which is used to enable the connection


establishment and connection termination on the basis of need. Switch is operated
on the Data link layer. In this packet filtering is available. It is a type of full duplex
transmission mode and it is also called an efficient bridge
27. VPN, advantages and disadvantages of it
VPN (Virtual Private Network) : VPN or the Virtual Private Network is a private WAN
(Wide Area Network) built on the internet. It allows the creation of a secured tunnel
(protected network) between different networks using the internet (public network).
By using the VPN, a client can connect to the organisation’s network remotely.

Advantages of VPN :
1. VPN is used to connect offices in different geographical locations remotely and is
cheaper when compared to WAN connections.
2. VPN is used for secure transactions and confidential data transfer between
multiple offices located in different geographical locations.
3. VPN keeps an organisation’s information secured against any potential threats or
intrusions by using virtualization.
4. VPN encrypts the internet traffic and disguises the online identity

28. Disadvantages of VPN :


1. Not designed for continuous use
2. Complexity prevents scalability
3. Lack of granular security
4. Unpredictable performance
5. Unreliable availability

29. LAN
A local area network (LAN) is a collection of devices connected together in one
physical location, such as a building, office, or home. A LAN can be small or large,
ranging from a home network with one user to an enterprise network with thousands
of users and devices in an office or school.

You might also like