Computer Science Paper 1
Computer Science Paper 1
Computer Science Paper 1
Ans:Friend function in C++ is the creative function that breaks the data hiding in an object-oriented programming
language. The data hiding prevents the access of private members externally from the class. The protected
members are inaccessible from the outside and can only be accessed by the derived classes.
The Characteristic of Friend Function :
A friend function is not in the scope of the class, in which it has been declared as friend.
- It cannot be called using the object of that class.
- It can be invoked like a normal function without any object.
- Unlike member functions, it cannot use the member names directly.
- It can be declared in public or private part without affecting its meaning.
- Usually, it has objects as arguments.
2. Explain in short the three special characteristic of a static data member in class .
Ans: Static Data Member :
A data member of a class can be qualified as static. Static data members can be used as a counter
that records the occurrences of all the objects. Static variables are used to maintain values common
to the entire class.
Characteristics of Static Data Member:
1. It is initialized to zero when the first object of its class is created.
2. It is visible only within the class, but its lifetime is the entire program.
3. Only one copy of that member is created for the entire class and it is shared by all the objects of
that class.
3.Discuss Virus Detection , Virus Removal and Prevention Philosophies.
Ans: Virus Detection: Virus isolation or detection of viral antigens or nucleic acid will confirm the presence of
specific viruses in clinical samples. However, positive results should be discussed with the laboratory to apportion
appropriate significance to this finding.
Virus Removal: Virus removal refers to the process of automatically or manually disinfecting or deleting a
computer virus, malware or any other malicious program on a computing device. The process is employed to
shield a computer from possible data loss, corruption, or system inaccessibility
Prevention Philosophies: Practice safe online behavior, regularly update software, use a firewall, and install
reputable antivirus programs to prevent virus infections.
2. Selection Logic (Conditional Flow) Selection Logic simply involves a number of conditions or parameters
which decides one out of several written modules. The structures which use these type of logic are known
as Conditional Structures. These structures can be of three types:
● Single AlternativeThis structure has the form:
● If (condition) then:
● [Module A]
[End of If structure]
In this way, the flow of the program depends on the set of conditions that are written. This can be more
understood by the following flow charts:
:
3. Iteration Logic (Repetitive Flow) The Iteration logic employs a loop which involves a repeat statement
followed by a module known as the body of a loop. The two types of these structures are:
● Repeat-For Structure This structure has the form:
● Repeat for i = A to N by I:
● [Module]
● [End of loop]
Here, A is the initial value, N is the end value and I is the increment. The loop ends when A>B. K increases
or decreases according to the positive and negative value of I respectively.
6. What function are perform by Memory Management of Operating System? State any four
Memory Management system.
Ans: The memory management function keeps track of the status of each memory location, either
allocated or free. It determines how memory is allocated among competing processes, deciding which gets
memory, when they receive it, and how much they are allowed.
1. Swapping : When the process is to be executed, then that process is taken from secondary memory to stored in
RAM.But RAM have limited space so we have to take out and take in the process from RAM time to time. This
process is called swapping. The purpose is to make a free space for other processes. And later on, that process is
swapped back to the main memory.
2. Paging : Paging is the memory management technique in which secondary memory is divided into
fixed-size blocks called pages, and main memory is divided into fixed-size blocks called frames. The Frame
has the same size as that of a Page. The processes are initially in secondary memory, from where the
processes are shifted to main memory(RAM) when there is a requirement. Each process is mainly divided
into parts where the size of each part is the same as the page size. One page of a process is mainly stored in
one of the memory frames. Paging follows no contiguous memory allocation. That means pages in the main
memory can be stored at different locations in the memory.
3.Compaction: Compaction is a memory management technique in which the free space of a running
system is compacted, to reduce fragmentation problem and improve memory allocation efficiency.
Compaction is used by many modern operating systems, such as Windows, Linux, and Mac OS X. As in the
fig we have some used memory(black color) and some unused memory(white color).The used memory is
combined.All the empty spaces are combined together.This process is called compaction.
4. Segmentation : Segmentation is another memory management technique used by operating systems. The
process is divided into segments of different sizes and then put in the main memory. The program/process is
divided into modules, unlike paging, in which the process was divided into fixed-size pages or frames. The
corresponding segments are loaded into the main memory when the process is executed. Segments contain
the program’s utility functions, main function, and so on.
7.What is Operating Function ? Describe the syntax of an Operator Function .Explain the difference between
Operator Function as Member Function and Friend Function .
Ans: An operating system is a program that manages a computer’s hardware. It also provides a basis
for application programs and acts as an intermediary between the computer user and computer
hardware. The main task an operating system carries out is the allocation of resources and services,
such as the allocation of memory, devices, processors, and information. The operating system also
includes programs to manage these resources, such as a traffic controller, a scheduler, a memory
management module, I/O programs, and a file system.
Mapping Operators to Functions
Operation Syntax Function
Equality a == b eq(a, b)
Difference a != b ne(a, b)
It can be declared in any number of classes It can be declared only in the private, public,
using the keyword friend. or protected scope of a particular class.
This function has access to all private and This function has access to private and
protected members of classes. protected members of the same class.
One can call the friend function in the main One has to create an object of the same class
function without any need to object. to call the member function of the class.
In linear search, input data doesn’t need to be Whereas, in binary search, input data has to be sorted according to
sorted . the order.
Multi-dimensional array is used for linear search. A single dimensional array is used for linear search.
2.Multi-level inheritance:In this inheritance, a derived class is created from another derived class.In the given
example, class c inherits the properties and behavior of class B and class B inherits the properties and behavior of class B.
So, here A is the parent class of B and class B is the parent class of C. So, here class C implicitly inherits the properties
and behavior of class A along with Class B i.e there is a multilevel of inheritance.
3.Multiple inheritance:In this inheritance, a derived class is created from more than one base class. This inheritance is
not supported by .NET Languages like C#, F#, etc., and Java Language.
In the given example, class c inherits the properties and behavior of class B and class A at the same level. So, here A and
Class B both are the parent classes for Class C.
4.Multipath inheritance: In this inheritance, a derived class is created from other derived classes and the same base
class of other derived classes. This inheritance is not supported by .NET Languages like C#, F#, etc.In the given example,
class D inherits the properties and behavior of class C and class B as well as Class A. Both class C and class B inherit the
Class A. So, Class A is the parent for Class B and Class C as well as Class D. So it's making it a Multipath inheritance.
5.Hierarchical Inheritance:In this inheritance, more than one derived class is created from a single base class and further
child classes act as parent classes for more than one child class.In the given example, class A has two children class B and
class D. Further, class B and class C both are having two children - class D and E; class F and G respectively.
6.Hybrid inheritance :This is a combination of more than one inheritance. Hence, it may be a combination of Multilevel
and Multiple inheritance or Hierarchical and Multilevel inheritance Hierarchical and Multipath inheritance, or
Hierarchical, Multilevel and Multiple inheritances.
Since .NET Languages like C#, F#, etc. do not support multiple and multipath inheritance. Hence hybrid inheritance with
a combination of multiple or multipath inheritances is not supported by .NET Languages.
Dynamic representation
The efficient way of representing a linked list is using the free pool of storage. In this method, there is a memory
bank (which is nothing but a collection of free memory spaces) and a memory manager (a program, in fact). During the creation
of a linked list, whenever a node is required the request is placed to the memory manager; the memory manager will then search
the memory bank for the block requested and, if found, grants the desired block to the caller. Again, there is also another
program called the garbage collector; it plays whenever a node is no more in use; it returns the unused node to the memory
bank. It may be noted that memory bank is basically a list of memory spaces which is available to a programmer. Such a
memory management is known as dynamic memory management. The dynamic representation of linked list uses the dynamic
memory management policy. .
Ans: 1. Root:In a tree data structure, the first node is called as Root Node. Every tree must have a root node.
We can say that the root node is the origin of the tree data structure. In any tree, there must be only one root
node. We never have multiple root nodes in a tree.
2. Siblings: In a tree data structure, nodes which belong to same Parent are called as SIBLINGS. In simple words, the nodes
with the same parent are called Sibling nodes.
3. Depth : In a tree data structure, the total number of egdes from root node to a particular node is called as DEPTH of that
Node. In a tree, the total number of edges from root node to a leaf node in the longest path is said to be Depth of the tree. In
simple words, the highest depth of any leaf node in a tree is said to be depth of that tree. In a tree, depth of the root node is '0'.
4. Leaf :In a tree data structure, the node which does not have a child is called as LEAF Node. In simple words, a leaf is
a node with no child.In a tree data structure, the leaf nodes are also called as External Nodes. External node is also a
node with no child. In a tree, leaf node is also called as 'Terminal' node.
13. What is Computer Virus ? What are the different methods by which virus ca infect other programs?
Ans : The metaphor of the "computer virus" was adopted because of the similarity in form, function and consequence
with biological viruses that attack the human system. Computer viruses can insert themselves in another program, taking
over control or adversely affecting the function of the program.
Infection Methods:
(a) Append: In this method viral code appends itself to the unaffected program.
(b) Replace: In this method viral code replaces original executable program completely or partially.
(c) Insert: In this method the viral code is inserted in the body of an executable code to carry out some funny
actions
14. With syntax diagram explain structure of HTML Webpage ?
Ans: HTML (HyperText Markup Language) files are, basically, just simple text files that you could create in any text
editor. But to be displayed correctly on the World Wide Web, an HTML document must be structured correctly. Any
variation from this structure will cause many web browsers to show the content incorrectly or not at all. Also, all HTML
documents must have a suffix of “html” for the HTML code to be viewed correctly by a web browser. Within a web page,
some HTML tags are required for the page to be displayed correctly. These tags are <html>, <head>, <title> and <body>.
The <html> tags must begin and end the document and the <head> tags must appear before the <body> tags. Also, the <title> tags must
be within the <head> tags. A simple explanation of each of these tags follows:
o <html> This tag and its end tag must be the first tag (after the Doctype) and the last tag in your document. It tells the
browser that everything within these tags should be viewed as HTML-coded information and should be parsed
accordingly by the browser.
o <head> This tag and its end tag sets apart the section of your document that will not be visible on your web page but
helps the browser in working with the document. Many different tags can be placed within the <head> tags, but in our
example above we only have the required tag, <title>.
o <title> This is an identifier for the overall content of a document. This is not displayed within your web page, but
(usually) at the top of your browser application's window titlebar. For example, this web page's <title> is "ETS - HTML
Basics - Structure" as you can see by looking at the titlebar of this browser window. This title is also displayed in a
browser's history and bookmarks, so it is best to be descriptive with this tag so that it will understandable out of context.
o <body> This tag contains all elements of your document that will appear within a browser's window. This is the content of
your document and is where the majority of HTML tags will be placed.
Example
<!DOCTYPE HTML>
<html>
<head>
<meta charset=utf-8">
<title>A Simple HTML Example</title>
<style>
p {text-align:center;}
</style>
</head>
<body>
<h1>This is a header</h1>
<p>This is a paragraph, centered on the page.</p>
<p>And this is the second paragraph with <strong>bold text</strong>.</p>
</body>
</html>
15. Explain the concept of function overloading with example .
Ans : The process of having two or more functions with the same name, but different parameters, is known
as function overloading.
The function is redefined by either using different types of arguments or a different number of arguments. It is
only through these differences that a compiler can differentiate between functions.
Ans: Main Features of Windows NT: As a personal computer operating system, Windows NT has some features. Main
features of Windows NT will be listed in the below. If you want to learn more, please focus on those Windows NT
features.
1. With multi-boot capability, Windows NT can coexist with other operating systems.
2. It implements preemptive multitasking and multithreading operations.
3. It supports multiple CPU systems with SMP (Symmetric Multiprocessing technology).
4. It supports a variety of hardware platforms such as CISI (Intel system) and RISC (such as Power PC, R400, etc.).
5. Interoperable with a variety of network operating systems such as UNIX, Novell Netware, Macintosh and other
systems. It provides extensive support for customer operating systems, such as MS-DOS, Windows, Windows NT
Workstation, UINX, OS/2, Macintosh, etc. Windows NT supports multiple protocols: TCP / IP, NetBEUI, DLC,
AppleTalk, NWLINK, etc.
17.State the various step involved in the allocation of partition in casw of fixed partition memory management .
Ans: Partition Allocation Methods in Memory Management
In the world of computer operating system, there are four common memory management techniques. They are:
1. Single contiguous allocation: Simplest allocation method used by MS-DOS. All memory (except some reserved
for OS) is available to a process.
2. Partitioned allocation: Memory is divided into different blocks or partitions. Each process is allocated according
to the requirement.
3. Paged memory management: Memory is divided into fixed-sized units called page frames, used in a virtual
memory environment.
4. Segmented memory management: Memory is divided into different segments (a segment is a logical grouping
of the process’ data or code).In this management, allocated memory doesn’t have to be contiguous.
Most of the operating systems (for example Windows and Linux) use segmentation with paging. A process is divided into
segments and individual segments have pages. In partition allocation, when there is more than one partition freely
available to accommodate a process’s request, a partition must be selected. To choose a particular partition, a partition
allocation method is needed. A partition allocation method is considered better if it avoids internal fragmentation. When it
is time to load a process into the main memory and if there is more than one free block of memory of sufficient size then
the OS decides which free block to allocate.
18. Explain the use of scope resolution Operator and Memory Management Operators in C++ with example.
Ans: Scope Resolution Operator in C++
This section will discuss the scope resolution operator and its various uses in the C++ programming language. The scope
resolution operator is used to reference the global variable or member function that is out of scope. Therefore, we use the
scope resolution operator to access the hidden variable or function of a program. The operator is represented as the double
colon (::) symbol.
Uses of the scope resolution Operator
1. It is used to access the hidden variables or member functions of a program.
2. It defines the member function outside of the class using the scope resolution.
3. It is used to access the static variable and static function of a class.
4. The scope resolution operator is used to override function in the Inheritance.
Memory management operators
● Arrays can be used to store multiple homogenous data but there are serious drawbacks of using arrays.
● Programmer should allocate the memory of an array when they declare it but most of time, the exact memory
needed cannot be determined until runtime.
● The best thing to do in this situation is to declare the array with maximum possible memory required (declare
array with maximum possible size expected) but this wastes memory.
● So, To avoid wastage of memory, you can dynamically allocate the memory required during runtime
using new and delete operator.
There are two types of memory management operators in C++:
● new
● delete
These two memory management operators are used for allocating and freeing memory blocks in efficient and convenient
ways.
New operator:
● The new operator in C++ is used for dynamic storage allocation. This operator can be used to create object of any
type.
● In the above statement, new is a keyword and the pointer variable is a variable of type datatype.
Delete operator:
● The delete operator in C++ is used for releasing memory space when the object is no longer needed.
● Once a new operator is used, it is efficient to use the corresponding delete operator for release of memory.
19. What is file system? Explain tape based and disk based file system.
Ans:A file system is a structure of directories that is used to organize and store files. The term file system is used to
describe the following: A particular type of file system: disk-based, network-based, or virtual. The entire file tree,
beginning with the root (/) directory.
Tape based :Data backed up to tape requires fewer resources to maintain. However, restoring data from tape might take a long time.
Following are the tape backup over online storage:
● Tape backups require fewer resources to maintain.
● You can place the archives in a more secure place than you can place a storage system.
● You can recover data from any release of Data ONTAP.
Disk based file system: Disk-based file systems are stored on physical media such as hard disks, DVDs, and diskettes. Disk-based file systems
can be written in different formats. The available formats are described in the following table.
UFS UNIX file system (based on the BSD Fat Fast File system that was provided in
the 4.3 Tahoe release). UFS is the default disk-based file system for the Oracle
Solaris OS.
Before you can create a UFS file system on a disk, you must format the disk and
divide it into slices. For information on formatting disks and dividing disks into
slices, see Chapter 10, Managing Disks (Overview).
ZFS The ZFS file system is available in the Solaris 10 6/06 release. For more
information, see the Oracle Solaris ZFS Administration Guide.
HSFS High Sierra, Rock Ridge, and ISO 9660 file system. High Sierra is the first
CD-ROM file system. ISO 9660 is the official standard version of the High
Sierra file system. The HSFS file system is used on CD-ROMs, and is a
read-only file system. Solaris HSFS supports Rock Ridge extensions to ISO
9660. When present on a CD-ROM, these extensions provide all UFS file system
features and file types, except for writability and hard links.
PCFS PC file system, which allows read- and write- access to data and programs on
DOS-formatted disks that are written for DOS-based personal computers.
UDFS The Universal Disk Format (UDFS) file system, the industry-standard format for
storing information on the optical media technology called DVD (Digital
Versatile Disc or Digital Video Disc).
20.What is VDU ? Explain following terms od VDU: 1. Dumb Terminal 2. Intelligent Terminal
Ans: Visual Display Unit : Terminal hardware is divided into two parts, (i) Keyboard: It is used a input medium. (ii)
Video Screen: It is used as output medium. The combination of above two is called as VDU (a) Dumb Terminal : It is
responsible for basic input and output of data.
1. Dumb Terminal:Dumb terminals are those that can interpret a limited number of control codes (CR, LF,
etc.) but do not have the ability to process special escape sequences that perform functions such as
clearing a line, clearing the screen, or controlling cursor position.
2. Intelligent Terminal : A device with some processing capability, by means of which information may be
transferred to and from a larger processing system. The device is often a combination of a display and
keyboard with at least one built-in microprocessor to provide facilities such as editing and prompts for the
operator. Modern application terminals for banking, retail, and industrial data collection are other
examples of intelligent terminals. Nowadays most such terminals are based on personal computer
technology...
Polymorphism is a feature that allows one interface to be used for a general class of actions. This means that the exact
method that gets called is determined at runtime, not at compile time. This provides flexibility, as it allows objects of
different classes to be treated as objects of a common superclass.
Abstraction is a feature that allows complex real world problems to be simplified by modelling them in a way that
captures only the relevant details. This is achieved by creating abstract classes and interfaces. An abstract class is a class
that cannot be instantiated, but can be subclassed, and an interface is a collection of abstract methods (methods without a
body).
23. Explain <OL>and <UL> tag used in HTML with example:
Ans: Ordered List: In HTML, we can create an ordered list using the <ol> tag. The ol in the tag stands for
an ordered list. Inside each of the ordered list elements <ol> and <ol />, we have to define the list items. We can define the
list items using the <li> tag.
Here is the complete HTML structure for an ordered list:
<ol>
<li>Eat</li>
<li>Code</li>
<li>Sleep</li>
</ol>
The output of the above ordered list is:
So, we have the list of elements ordered with a number starting with 1 and incremented to 2 and 3. Try this CodePen and
see if you can change and play around with using ol-li.
Unordered List : Let's move over to unordered lists now. We use the <ul> tag to create an unordered list. As usual, we
need to use the <li> tags within <ul> and <ul/> to create the list items.
The list items (li) inside the unordered list (ul) come with the default style of bullet points – so each of the list items is
preceded by a black dot.
Let's create a list of my favorite online resources to learn about web programming:
My Favorite Web Development Learning Sites
<div>
<ul>
<li>freeCodeCamp</li>
<li>CSS-Tricks</li>
<li>Traversy Media</li>
</ul>
</div>
The output looks like this:
24. Expliain how member function of class can be defined outside the class definition and inside class definition
with example in C++.
Ans: Member functions of a class can be defined either outside the class definition or inside the class definition. In both
the cases, the function body remains the same, however, the function header is different.
Outside the Class: Defining a member function outside a class requires the function declaration (function prototype) to
be provided inside the class definition. The member function is declared inside the class like a normal function. This
declaration informs the compiler that the function is a member of the class and that it has been defined outside the class.
After a member function is declared inside the class, it must be defined (outside the class) in the program.
The definition of member function outside the class differs from normal function definition, as the function name in the
function header is preceded by the class name and the scope resolution operator (: :). The scope resolution operator
informs the compiler what class the member belongs to. The syntax for defining a member function outside the class is
1 class book {
2 // body of the class
3 };
4 void book :: getdata(char a[],float b) {
5 // defining member function outside the
class
6
strcpy(title,a):
7 price = b:
8 }
9 void book :: putdata () {
10 cout<<"\nTitle of Book: "<<title;
11 cout<<"\nPrice of Book: "<<price;
12}
Note that the member functions of the class can access all the data members and other member functions of the same class
(private, public or protected) directly by using their names. In addition, different classes can use the same function name.
Inside the Class: A member function of a class can also be defined inside the class. However, when a member function is
defined inside the class, the class name and the scope resolution operator are not specified in the function header.
Moreover, the member functions defined inside a class definition are by default inline functions.To understand the
concept of defining a member function inside a class, consider this example.
Example : Definition of a member function inside a class
1class book {
2 char title[30];
3 float price;
4 public:
void getdata(char [],float); II declaration
5 void putdata()//definition inside the class
6{
7 cout<<"\nTitle of Book: "<<title;
8 cout<<"\nPrice of Book: "<<price;
9} ;
In this example, the member function putdata() is defined inside the class book. Hence, putdata() is by default an inline
function.Note that the functions defined outside the class can be explicitly made inline by prefixing the keyword inline
before the return type of the function in the function header. For example, consider the definition of the function getdata().
public:
// declaring constructor
class_name({parameters})
{
// constructor body
}
};
Destructor: Destructor is just the opposite function of the constructor. A destructor is called by the compiler when the
object is destroyed and its main function is to deallocate the memory of the object. The object may be destroyed when the
program ends, or local objects of the function get out of scope when the function ends or in any other case.
Destructor has the same as of the class with prefix tilde(~) operator and it cannot be overloaded as the constructor.
Destructors take no argument and have no return type and return value.
The basic syntax of the Destructor is given below
class class_name{
private:
// private members
public:
// declaring destructor
~class_name()
{
// destructor body
}
};
30. What is Data Structure ? Explain Linear Data Structure and Non-Linear Data Structure.
Ans: Data structures are a specific way of organizing data in a specialized format on a computer so that the information
can be organized, processed, stored, and retrieved quickly and effectively. They are a means of handling information,
rendering the data for easy use.
Difference Between Linear and Non-linear Data Structures
'Reaction' can be as simple as a phone call to the local police, or it could be a security team for larger sites.A security
team will patrol your site and respond to intrusion events which have been picked up by the Perimeter Intrusion Detection
system and then verified by the CCTV system.
After all, if the technology alerts you to an intruder's presence but you do nothing about it, everything up to this point is
then redundant.
33.Differentiate between Traditional Procedural Programming Approach and Object Oriented Programming
Approach.
:
Ans Comparison Between Traditional Approach and Object-Oriented Approach to Development in Software
Engineering
34.Define Following Terms: 1. Group Item 2. Elementary Item 3. Entity
Ans: Elementary Items − Data items that cannot be divided are called as Elementary Items.
Group Items − Data items that are divided into sub items are called as Group Items.
35. What is Binary Tree ? With suitable example show the relationship between Total Number of Node and Depth
of Binary Tree.
Ans: A binary tree is a tree-type non-linear data structure with a maximum of two children for each parent. Every node in
a binary tree has a left and right reference along with the data element. The node at the top of the hierarchy of a tree is
called the root node. The nodes that hold other sub-nodes are the parent nodes.
Total Number of Node:Since all the levels are completely filled, we know that level 0 will have 1 node, level 1
will have 2 nodes, level 2 will have 4 nodes, and so on. So, the total number of nodes will be 2^0 + 2^1 + ... +
2^h where h is the height of the tree. This equals to 2^(h+1) - 1 . Input:
root = [1, 2, 3, 4, 5, 6]
Output: 6
Constraints
● The number of nodes is less than 10^5.
● The input is guaranteed to be a complete binary tree.
● Tree size fits in memory.
Depth of Binary Tree: The depth of a node in a binary tree is the number of edges from the root node to another node.
It is calculated by counting the number of edges traversed from the root node to the given node.
1 5: 1->2–>5 = 2 edges
/\
2 3 6: 1->2->6 = 2 edges
/\
56 3: 1 -> 3 = 1 edges
36. What is Record ? Explain how records are represented in memory using array.
Ans: In memory, records can be represented using arrays. An array is a collection of data items that are stored in
contiguous memory locations and are accessed using an index or subscript. Each element in the array can hold a single
value of a specific data type, such as an integer, string, or floating-point number.
Represented in memory using array:
(1) Records are a collection of nonhomogeneous data so it can not be stored in an array.
(2) In entire file of records all data elements belonging to the same identifier will be of same type. So file may be stored in
memory as collection of arrays.
(3) For representation we can use one array for each data item.
37. Explain following terms in case of Process Scheduling:1.Turn –around Time 2. Waiting Time 3. Terminal
Response Time 4. Event Response Time.
Ans: Turn-around time (TAT) is the time interval from the time of submission of a process to the time of the completion
of the process. It can also be considered as the sum of the time periods spent waiting to get into memory or ready queue,
execution on CPU and executing input/output. Turnaround time is an important metric in evaluating the scheduling
algorithms of an operating system. Turnaround time is the total amount of time spent by the process from coming in the
ready state for the first time to its completion.
Turnaround time = Burst time + Waiting time
or
Turnaround time = Exit time - Arrival time
Waiting time:Waiting time is the total time spent by the process in the ready state waiting for CPU. For example,
consider the arrival time of all the below 3 processes to be 0 ms, 0 ms, and 2 ms and we are using the First Come First
Serve scheduling algorithm.
Then the waiting time for all the 3 processes will be:
P1: 0 ms
P2: 8 ms because P2 have to wait for the complete execution of P1 and arrival time of P2 is 0 ms.
P3: 13 ms becuase P3 will be executed after P1 and P2 i.e. after 8+7 = 15 ms and the arrival time of P3 is 2 ms. So, the
waiting time of P3 will be: 15-2 = 13 ms.
Terminal Response time : In the time -sharing system, Terminal response time is the time to respond with an answer or
result to a question and it depends on degree of multiprogramming, the efficiency of hardware with OS and policy of OS
to allocate resources.
Event Response time: In the real - time system , event response time is the time to respond with an event.