Download as pdf or txt
Download as pdf or txt
You are on page 1of 120

LABORATORY MANUAL

OPERATING SYSTEMS
AND
SOFTWARE ENGINEERING LAB

Regulations : GRBT-20

Programme/ Semester : UG / IV Semester

Branch : CSE(CS)

Department of Computer Science (AIML &CS)

GODAVARI INSTITUTE OF ENGINEERING &


TECHNOLOGY (Autonomous)

NH-16, CHAITANYA KNOWLEDGE CITY, RAJAHMUNDRY – 533 296


Operating Systems and Software Engineering Lab

List of Experiments

PART-A (OPERATING SYSTEMS)

1. Simulate the following CPU scheduling algorithms


a. Round Robin b. SJF c. FCFS d. Priority
2. Multiprogramming-Memory management- Implementation of fork(), wait(), exec() and
exit(), System calls
3. Simulate the following
a. Multiprogramming with a fixed number of tasks (MFT)
b. Multiprogramming with a variable number of tasks (MVT)
4. Simulate Bankers Algorithm for Dead Lock Avoidance
5. Simulate Bankers Algorithm for Dead Lock Prevention.
6. Simulate the following page replacement algorithms.
a. FIFO b. LRU c. LFU
7. Simulate the following File allocation strategies
a. Sequenced b. Indexed c. Linked
8. Simulate the following disk scheduling algorithms
a. FCFS b. SCAN c. CSCAN d. SSTF

PART-B (SOFTWARE ENGINEERING)

9. Perform the following, for the following experiments:


a. Do the Requirement Analysis and Prepare SRS
b. Draw E-R diagrams, DFD, CFD and structured charts for the project.
10. Course Registration System
11. Students Marks Analyzing System
12. Online Ticket Reservation System
13. Stock Maintenance
14. Draw the UML Diagrams for the problem 1, 2, 3, 4.
15. Design the test cases for e-Commerce application (Flipkart, Amazon)
16. Design the test cases for a Mobile Application (Consider any example from App store)
17. Design and Implement ATM system through UML Diagrams.
Course Objectives:
 Learn the various process scheduling algorithms
 Understand the concept of system calls, Bankers Algorithm for Deadlocks
 Understand the concepts of page replacement algorithms and disk scheduling algorithms
 Understand the Rational Rose software and draw various UML diagrams for s/w design
 Understand the testing techniques and generate test cases using them.

CourseOutcomes:
CO-1: Implement various CPU scheduling, page replacement and disk scheduling algorithms.
CO-2: Implement various system calls.
CO-3: Implement Bankers algorithm for Dead Lock Avoidance and Prevention
CO-4: Implement the file allocation strategies
CO-5: Develop function oriented and object-oriented software design using tools like
rationalrose.
CO-6: Design test cases for software testing
Exp. No. Name of the Experiment Page No
Implement a C program for FCFS
1(a) Process Scheduling Algorithm 1-2

Implement a C program for SJF Process 3-5


1(b) Scheduling Algorithm
Implement a C program for Priority 6-8
1(c) Process Scheduling Algorithm
Implement a C program for Round 9-10
1(d) Robin Process Scheduling Algorithm
Implementation of fork (), wait (), exec 11-12
2 () and exit () System calls
Write a C program to simulate multi- 13-15
programming with a fixed number of
3(a)
tasks (MFT)
Write a C program to simulate multi- 16-17
programming with a variable number of
3(b)
tasks (MVT)
Write a C program to simulate Bankers 18-19
4 Algorithm for Dead Lock Avoidance
Write a C program to simulate Bankers
5 Algorithm for Dead Lock Prevention 20-22
Write a C program to simulate the FIFO 23-24
6(a) page replacement algorithm
Write a C program to simulate the LRU 25-27
6(b) page replacement algorithm
Write a C program to simulate the LFU 28-31
6(c) page replacement algorithm
Write a C program to simulate the 32-33
7(a) Sequenced File allocation strategy
Write a C program to simulate the 34-36
7(b) Indexed File allocation strategy
Write a C program to simulate the 37-38
7(c) Linked File allocation strategy
Write a C program to simulate the 39-40
8(a) FCFS disk scheduling algorithm
Write a C program to simulate the 41-44
8(b) SCAN disk scheduling algorithm
Write a C program to simulate the 45-48
8(c) CSCAN disk scheduling algorithm
Write a C program to simulate the SSTF 48-50
8(d) disk scheduling algorithm

Exp.No. Name of the Experiment

Draw ER Diagrams, DFD for the 51-58


1 project
59-60
2 1. Course Registration System
61-62
2. Student Marks Analyzing system
3
63-64
3. Online Ticket Reservation System
4
65-66
5 4. Stock Maintenance

Draw UML Diagrams for the project 67-74


6 (1,2)
Draw UML Diagrams for the project 75-79
7 (3,4)

Design the testcases for E-commerce 80-82


8 application (Flipkart, Amazon)
Design the testcases for Mobile 83-87
Application (Consider any example from
9
Appstore)
Design and implement ATM SYSTEM 88-90
10 through UML Diagrams
Evaluation of Laboratory Marks

1. Practical(s) shall be evaluated for 100 marks out of which 50 marks shall be
for internal
assessment and the remaining 50 marks shall be for summative assessment.
2. Award of 50 marks for internal assessment shall be done as follows:
a. A maximum of 25 marks shall be assigned by continuous evaluation,
day to day experimental work.
b. A maximum of 25 marks shall be awarded by conducting TWO
internal practical examinations, one at the middle of the semester and
the other at the end of the semester. There shall be two examiners for
each internal examination. One shall be the faculty member concerned
and the other shall be an internal faculty member nominated by the
HoD. Out of the two, the internal practical examination with highest
score shall be given a weightage of 80% and the other the weightage of
20%.
The evaluation is as follows
I. Continuous evaluation - 25 marks
II. Internal Laboratory Exam1 - 25 marks
III. Internal Laboratory Exam2 - 25 marks

I. Continuous Evaluation 25 marks


a) Day to day evaluation: 20 marks
i. Attendance 5 out of 20
ii. Experiments and observation 5 out of 20
iii. Result 5 out of 20
iv. Record 5 out of 20
b) Viva voice 5 marks
II. Internal Laboratory Exam1 25 marks
a) Exam 20 marks
i. Experiments write up 10 out of 20
ii. Result and Graphs 10 out of 20
b) Viva voice 5 marks

II. Internal Laboratory Exam2 25 marks

b) Exam 20 marks
i. Experiments write up 10 out of 20
ii. Result and Graphs 10 out of 20
b) Viva voice 5 marks
I. Continuous evaluation - 25 marks
a) Day to day evaluation - 20 marks
Each experiment / program will be evaluated for 20 marks.
The splitting of marks is as follows
i) Attendance – 5 marks
The student should attend the lab regularly; if he/she is absent he/she will be
losing 5 marks.
ii) Experiments and observation
The student should complete the program within the assigned time otherwise he /
she will be losing 5 marks.
iii) Experiment result will carry 5 marks.
iv) Record 5 marks

Student must submit the record in the next lab session.

b) Viva Voice – 5 marks

II. Internal laboratory examination - 25 marks


a) Exam – 20 marks
The Splitting of marks as follows
i) Experiments write up - 10 marks
ii) Result and Graphs – 10 marks
b) Viva Voice - 5 marks

The internal lab examination duration - 2 hours


Every student will be given experiments in the internal lab exam. In case the
student wishes to change the experiments 5 marks will be deducted. A time slot of 45
minutes is given for write up of programs / experiments.
The student is expected to complete the assigned program / experiment within 1
hour and the remaining 15 minutes will be utilized for viva voce examination.
1. There shall be no supplementary exams in case the student fails to attend internal
lab.
Evaluation of Laboratory Marks (End exams)
1. The external lab examination schedules will be given by the Examination Branch.
2. Duration of External lab examinations - 3 Hours
3. Exam will be evaluated for 50 Marks

I. Experiment write-up 15 marks


II. Experiment Setup execution 15 marks
III. Result 5 marks
IV. Record Book 5 marks
V. Viva-Voce 10 marks
EXPERIMENT NO: 01

(a)Implement a C program for FCFS Process Scheduling Algorithm

Algorithm

1. Start
2. Declare the array size
3. Read the number of processes to be inserted
4. Read the Burst times of processes
5. Calculate the waiting time of each process
wt[i+1]=bt[i]+wt[i]
6. Calculate the turnaround time of each process
tt[i+1]=tt[i]+bt[i+1]
7. Calculate the average waiting time and average turnaround time.
8. Display the values
9. Stop

PROGRAM:

#include<stdio.h>

#include<conio.h>

void main(){

int i,n,pro[5],bt[10],wt[10],tat[10],w1=0,t1=0;

float avgwt,avgtat;

printf("Enter no of processes::\n");

scanf("%d",&n);

printf("Enter the burst time or service times::\n");

for(i=0;i<n;i++){

scanf("%d",&bt[i]);

for(i=0;i<n;i++){

wt[0]=0;

1|P ag e
tat[0]=bt[0];

// calculating waiting time

wt[i+1]=bt[i]+wt[i];

// calculating turnaround time

tat[i+1]=tat[i]+bt[i+1];

// calculating the total of waiting time and turnaround time

w1=w1+wt[i];

t1=t1+tat[i];

}// average waiting time and turn around time

avgwt=w1/n;

avgtat=t1/n;

printf("\nProcesses\tBursttime\tWaitingtime\tTurnaroundtime\n");

for(i=0;i<n;i++){

printf("%d\t %d\t %d\t %d\n",(i+1),bt[i],wt[i],tat[i]);

printf("Average Waiting Time=%f\n",avgwt);

printf("Turn Around Time=%f\n",avgtat);

OUTPUT:

Enter no of processes::

Enter the burst time or service times::

2|P ag e
4

10

Processes BursttimeWaitingtimeTurnaroundtime

1 7 0 7

2 3 7 10

3 4 10 14

4 10 14 24

Average Waiting Time=7.000000

Turn Around Time=13.000000

(b)Implement a C program for SJF Process Scheduling Algorithm

ALGORITHM

1. Start
2. Declare the array size
3. Read the number of processes to be inserted
4. Read the Burst times of processes
5. Sort the Burst times in ascending order and process with shortest burst time is first
executed.
6. Calculate the waiting time of each process
wt[i+1]=bt[i]+wt[i]
7. Calculate the turnaround time of each process
tt[i+1]=tt[i]+bt[i+1]
8. Calculate the average waiting time and average turnaround time.
9. Display the values
10. Stop

PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

3|P ag e
int i,j,bt[10],temp,n,wt[10],tat[10];

float w1=0,t1=0;

float avgwt,avgtat;

printf("Enter no. of processes:\n");

scanf("%d",&n);

printf("Enter the burst time of processes:\n");

for(i=0;i<n;i++)

scanf("%d",&bt[i]);

// sorting the processes based on burst time

for(i=0;i<n;i++)

for(j=i;j<n;j++)

if(bt[i]>bt[j])

temp=bt[i];

bt[i]=bt[j];

bt[j]=temp;

for(i=0;i<n;i++)

wt[0]=0;

tat[0]=bt[0];

// calculating waiting time and turn around time

wt[i+1]=bt[i]+wt[i];

4|P ag e
tat[i+1]=tat[i]+bt[i+1];

// calculating total waiting time

w1=w1+wt[i];

// calculating total turn around time

t1=t1+tat[i];

avgwt=w1/n;

avgtat=t1/n;

printf("\nProcesses \tBursttime\t Waitingtime\t TurnAroundtime\n");

for(i=0;i<n;i++){

printf("%d\t %d\t %d\t %d\n",(i+1),bt[i],wt[i],tat[i]);

printf("Average Waiting Time=%f\n",avgwt);

printf("Average Turn Around Time=%f\n",avgtat);

OUTPUT:

Enter no. of processes:

Enter the burst time of processes:

5|P ag e
4

10

Processes BursttimeWaitingtimeTurnAroundtime

1 3 0 3

2 4 3 7

3 7 7 14

4 10 14 24

Average Waiting Time=6.000000

Average Turn Around Time=12.000000

6|P ag e
(c)Implement a C program for Priority Process Scheduling Algorithm

ALGORITHM

1. Start
2. Declare the array size
3. Read the number of processes to be inserted
4. Read the Priorities of processes
5. Sort the priorities and Burst times in ascending order
5. Calculate the waiting time of each process
wt[i+1]=bt[i]+wt[i]
6. Calculate the turnaround time of each process
tt[i+1]=tt[i]+bt[i+1]
6. Calculate the average waiting time and average turnaround time.
7. Display the values
8. Stop

PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

int i,j,pno[10],prior[10],bt[10],n,wt[10],tat[10],w1=0,t1=0,s;

float avgwt,avgtat;

printf("Enter the number of processes:");

scanf("%d",&n);

for(i=0;i<n;i++)

// asking for the burst times and priority

printf("The process %d:\n",i+1);

printf("Enter the burst time of processes:");

scanf("%d",&bt[i]);

7|P ag e
printf("Enter the priority of process %d:",i+1);

scanf("%d",&prior[i]);

pno[i]=i+1;

//sorting based on priority

for(i=0;i<n;i++)

for(j=0;j<n;j++)

if(prior[i]<prior[j])

s=prior[i];

prior[i]=prior[j];

prior[j]=s;

s=bt[i];

bt[i]=bt[j];

bt[j]=s;

s=pno[i];

pno[i]=pno[j];

pno[j]=s;

for(i=0;i<n;i++)

8|P ag e
wt[0]=0;

tat[0]=bt[0];

// calculating waiting time and turn around time

wt[i+1]=bt[i]+wt[i];

tat[i+1]=tat[i]+bt[i+1];

// claculating total wating time and turn around time

w1=w1+wt[i];

t1=t1+tat[i];

avgwt=w1/n;

avgtat=t1/n;

printf(" \nProcesses \t priority \t Bursttime \t Waitingtime \t Turnaroundtime\n");

for(i=0;i<n;i++){

printf("%d\t %d \t %d\t %d\t %d\n",pno[i],prior[i],bt[i],wt[i],tat[i]);

printf("Average Waiting Time=%f\n",avgwt);

printf("Average Turn Around Time=%f",avgtat);

OUTPUT:

Enter the number of processes:4

The process 1:

Enter the burst time of processes:7

Enter the priority of process 1:1

The process 2:

Enter the burst time of processes:3

9|P ag e
Enter the priority of process 2:0

The process 3:

Enter the burst time of processes:4

Enter the priority of process 3:3

The process 4:

Enter the burst time of processes:10

Enter the priority of process 4:2

Processes priority BursttimeWaitingtimeTurnaroundtime

2 0 3 0 3

1 1 7 3 10

4 2 10 10 20

3 3 4 20 24

Average Waiting Time=8.000000

Average Turn Around Time=14.000000

(d)Implement a C program for Round Robin Process Scheduling Algorithm

ALGORITHM

1. Start
2. Declare the array size
3. Read the number of processes to be inserted
4. Read the burst times of the processes
5. Read the Time Quantum
6. If the burst time of a process is greater than time Quantum
then subtract time quantum form the burst time
else assign the burst time to time quantum.
7. Calculate the average waiting time and turnaround time of the
processes.
8. Display the values
9. Stop

10 | P a g e
PROGRAM:

#include<stdio.h>
#include<conio.h>
void main()
{
int st[10],bt[10],wt[10],tat[10],n,tq;
int i,count=0,t_wt=0,t_tat=0,temp,sq=0;
float avgwt=0.0,avgtat=0.0;
printf("Enter number of processes:");
scanf("%d",&n);
printf("Enter burst time for sequences:\n");
for(i=0;i<n;i++)
{
scanf("%d",&bt[i]);
st[i]=bt[i];
}
printf("Enter time quantum:");
scanf("%d",&tq);
while(1)
{
for(i=0,count=0;i<n;i++)
{
temp=tq;
if(st[i]==0)
{
count++;
continue;
}
if(st[i]>tq)
st[i]=st[i]-tq;
else
if(st[i]>=0)
{
temp=st[i];
st[i]=0;
}
sq=sq+temp;
tat[i]=sq;
}

11 | P a g e
if(n==count)
break;
}
for(i=0;i<n;i++)
{
wt[i]=tat[i]-bt[i];
t_wt=t_wt+wt[i];
t_tat=t_tat+tat[i];
}
avgwt=t_wt/n;
avgtat=t_tat/n;
printf("Process_no Burst time Wait time Turnaround time");
for(i=0;i<n;i++)
printf("\n%d\t %d\t %d\t %d",i+1,bt[i],wt[i],tat[i]);
printf("\nAverage waiting time is %f",avgwt);
printf("\nAverageTurn around time is %f",avgtat);
}

OUTPUT:

Enter number of processes:4


Enter burst time for sequences:
5
1
10
6
Enter time quantum:3
Process_no Burst time Wait time Turnaround time
1 5 7 12
2 1 3 4
3 10 12 22
4 6 12 18
Average waiting time is 8.000000
Average Turn around time is 14.000000

12 | P a g e
EXPERIMENT NO: 02

Implementation offork(), wait(), exec() and exit() System calls

PROGRAM:
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<stdlib.h>

int main()
{
int pid;
pid=fork();
if(pid<0)
{

printf("\nfork failed\n");
exit(-1);
}
else if(pid==0)
{
printf("welcome to parent");
execlp("/bin/ls","ls","-1",NULL);

}
else
{
wait(NULL);
printf("\nchild complete\n");
exit(0);

13 | P a g e
}}

OUTPUT
guest-glcbIs@ubuntu:~$gcc –o lsc.outlsc.c
guest-glcbIs@ubuntu:~$./lsc.out
total 100
-rwxrwx—x 1 guest-glcbls guest-glcbls 140 2012-07-06 14:55 f1
drwxrwxr-x 4 guest-glcbls guest-glcbls 140 2012-07-06 14:40 dir1
child complete

14 | P a g e
EXPERIMENT NO: 03

a) Writea C program to simulate Multi-programming with a fixed number of tasks (MFT)

Concept:
In this the memory is divided in two parts and process is fit into it. The process which is best
suited in to it is placed in the particular memory where it suits. We have to check memory
partition. If it suits, its status should be changed

ALGORITHM:
Step1: Start the process.
Step2: Declare variables.
Step3: Enter total memory sizems.
Step4: Allocate memory for os.
Ms=ms-os
Step5: Read the no partition to be divided n Partition size=ms/n.
Step6: Read the process no and process size.
Step 7: If process size is less than partition size the process. While allocating update memory
wastage-external fragmentation.

PROGRAM:
#include<stdio.h>
#include<conio.h>

int main()
{
int ms, bs, nob, ef,n, mp[10],tif=0;
int i,p=0;
printf("Enter the total memory available (in Bytes) -- ");
scanf("%d",&ms);

printf("Enter the block size (in Bytes) -- ");


scanf("%d", &bs);
nob=ms/bs;
ef=ms - nob*bs;

15 | P a g e
printf("\nEnter the number of processes -- ");
scanf("%d",&n);
for(i=0;i<n;i++)
{

printf("Enter memory required for process %d (in Bytes)-- ",i+1);


scanf("%d",&mp[i]);
}
printf("\nNo. of Blocks available in memory -- %d",nob);
printf("\n\nPROCESS\tMEMORY REQUIRED\t ALLOCATED\tINTERNAL
FRAGMENTATION");
for(i=0;i<n && p<nob;i++)
{
printf("\n %d\t\t%d",i+1,mp[i]);
if(mp[i] > bs)

printf("\t\tNO\t\t---");
else
{
printf("\t\tYES\t%d",bs-mp[i]);
tif = tif + bs-mp[i];
p++;

}
}
if(i<n)
printf("\nMemory is Full, Remaining Processes cannot be accomodated");
printf("\n\nTotal Internal Fragmentation is %d",tif);
printf("\nTotal External Fragmentation is %d",ef);

return 0;}

16 | P a g e
OUTPUT:

Enter the number of processes -- 3

Enter memory required for process 1 (in Bytes)-- 200


Enter memory required for process 2 (in Bytes)-- 500
Enter memory required for process 3 (in Bytes)-- 200

No. of Blocks available in memory -- 2

PROCESS MEMORYREQUIRED ALLOCATED INTERNAL


FRAGMENTATION
1 200 YES 200
2 500 NO ---
3 200 YES 200

Total Internal Fragmentation is 400


Total External Fragmentation is 200

17 | P a g e
b) Write a C program to simulate Multi-programming with a variable number of tasks
(MVT)

PROGRAM:
#include<stdio.h>
#include<conio.h>
main()
{
int ms,mp[10],i, temp,n=0;
char ch = 'y';
printf("\nEnter the total memory available (in Bytes)-- ");
scanf("%d",&ms);
temp=ms;
for(i=0;ch=='y';i++,n++)
{
printf("\nEnter memory required for process %d (in Bytes) -- ",i+1);
scanf("%d",&mp[i]);
if(mp[i]<=temp)
{
printf("\nMemory is allocated for Process %d ",i+1);
temp = temp - mp[i];
}
else
{
printf("\nMemory is Full");
break;
}
printf("\nDo you want to continue(y/n) -- ");
scanf(" %c", &ch);
}
printf("\n\nTotal Memory Available -- %d", ms);
printf("\n\n\tPROCESS\t\t MEMORY ALLOCATED ");
for(i=0;i<n;i++)
printf("\n \t%d\t\t%d",i+1,mp[i]);
printf("\n\nTotal Memory Allocated is %d",ms-temp);
printf("\nTotal External Fragmentation is %d",temp);
}

18 | P a g e
OUTPUT:

Enter the total memory available (in Bytes)-- 1000


Enter memory required for process 1 (in Bytes) -- 300
Memory is allocated for Process 1
Do you want to continue(y/n) -- y
Enter memory required for process 2 (in Bytes) -- 400
Memory is allocated for Process 2

Do you want to continue(y/n) -- y


Enter memory required for process 3 (in Bytes) – 500
Memory is Full
Total Memory Available – 1000
PROCESS MEMORY ALLOCATED
1 300

2 400
Total Memory Allocated is 700
Total External Fragmentation is 300

19 | P a g e
EXPERIMENT NO: 04

Write a C program to simulate Bankers Algorithm for Dead Lock Avoidance

PROGRAM

#include<stdio.h>
#include<conio.h>
void main() {
int
k=0,output[10],d=0,t=0,ins[5],i,avail[5],allocated[10][5],need[10][5],MAX[10][5],pno,P[10],j,rz
, count=0;
printf("Enter the number of resources : ");
scanf("%d", &rz);
printf("Enter the max instances of each resources :\n");
for (i=0;i<rz;i++) {
avail[i]=0;
printf("%c= ",(i+97));
scanf("%d",&ins[i]);
}
printf("Enter the number of processes : ");
scanf("%d", &pno);
printf("\n Enter the allocation matrix \n ");
for (i=0;i<rz;i++)
printf(" %c",(i+97));
printf("\n");
for (i=0;i <pno;i++) {
P[i]=i;
printf("P[%d] ",P[i]);
for (j=0;j<rz;j++) {
scanf("%d",&allocated[i][j]);
avail[j]+=allocated[i][j];
}
}
printf("\nEnter the MAX matrix \n ");
for (i=0;i<rz;i++) {
printf(" %c",(i+97));
avail[i]=ins[i]-avail[i];
}
printf("\n");
for (i=0;i <pno;i++) {

20 | P a g e
printf("P[%d] ",i);
for (j=0;j<rz;j++)
scanf("%d", &MAX[i][j]);
}
printf("\n");
A: d=-1;
for (i=0;i <pno;i++) {
count=0;
t=P[i];
for (j=0;j<rz;j++) {
need[t][j] = MAX[t][j]-allocated[t][j];
if(need[t][j]<=avail[j])
count++;
}
if(count==rz) {
output[k++]=P[i];
for (j=0;j<rz;j++)
avail[j]+=allocated[t][j];
} else
P[++d]=P[i];
}
if(d!=-1) {
pno=d+1;
goto A;
}
printf("Sequence of Execution :");
for (i=0;i<k;i++)
printf(" P[%d] ",output[i]);
}
OUTPUT

Enter the number of resources : 3


Enter the max instances of each resources :
a= 10
b= 5
c= 7
Enter the number of processes : 5

Enter the allocation matrix


abc

21 | P a g e
P[0] 010
P[1] 200
P[2] 302
P[3] 211
P[4] 002

Enter the MAX matrix


abc
P[0] 7 5 3
P[1] 3 2 2
P[2] 9 0 2
P[3] 4 2 2
P[4] 5 3 3

Sequence of Execution : P[1] P[3] P[4] P[0] P[2]

22 | P a g e
EXPERIMENT NO: 05

Write a C program to simulateBankers Algorithm for Dead Lock Prevention

PROGRAM

#include<stdio.h>
void main()
{
int max[10][10],a1[10][10],av[10],i,j,k,m,n,ne[10][10],flag=0;
printf("\nEnter the processes and resources :");
scanf("%d%d",&m,&n);
printf("\n Enter the maximum matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&max[i][j]);
}
}
printf("\n Enter allocated matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a1[i][j]);
}
}
printf("\n The need matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
ne[i][j]=max[i][j]-a1[i][j];
printf("\t%d",ne[i][j]);
}
printf("\n");
}
printf("\n Enter available matrix:\n");
for(i=0;i<n;i++)
scanf("%d",&av[i]);

23 | P a g e
printf("\n Maximum matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("\t%d",max[i][j]);
}
printf("\n");
}
printf("\n Allocated matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("\t%d",a1[i][j]);
}
printf("\n");
}
printf("\n Available matrix:\n");
for(i=0;i<n;i++)
{
printf("%d\t",av[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(av[i]>=ne[i][j])
flag=1;
else
flag=0;
}
}
if(flag==0)
printf("\n Unsafe state");
else
printf("\n safe state");
}

24 | P a g e
OUTPUT

Enter the processes and resources : 3 3

Enter the maximum matrix:


368
433
344

Enter allocated matrix:


223
203
124

The need matrix:


1 4 5
2 3 0
2 2 0

Enter available matrix:

230

Maximum matrix
3 6 8
4 3 3
3 4 4

Allocated matrix:
2 2 3
2 0 3
1 2 4

Available matrix:
2 3 0

safe state

25 | P a g e
EXPERIMENT NO: 06

a) Write a C program to simulate the FIFO page replacement algorithm

PROGRAM:
#include<stdio.h>
int main()
{

int i,j,n,a[50],frame[10],no,k,avail,count=0;
printf("Enter the no of pages: ");
scanf("%d",&n);
printf("Enter the page no: ");
for(i=1;i<=n;i++)
scanf("%d",&a[i]);

printf("Enter the no of page frames: ");


scanf("%d",&no);
for(i=0;i<no;i++)
frame[i]= -1;
j=0;
printf("\tPAGE NO\t PAGE FRAMES\n");

for(i=1;i<=n;i++)
{
printf("%d\t\t",a[i]);
avail=0;
for(k=0;k<no;k++)
if(frame[k]==a[i])

avail=1;
if (avail==0)
{

26 | P a g e
frame[j]=a[i];
j=(j+1)%no;
count++;
for(k=0;k<no;k++)

printf("%d\t",frame[k]);
}
printf("\n");
}
printf("Page Fault Is %d",count);
return 0;

OUTPUT:
Enter the no of pages: 7
Enter the page no: 1 3 0 3 5 6 3
Enter the no of page frames: 3
PAGE NO PAGE FRAMES

1 1 -1 -1
3 1 3 -1
0 1 3 0
3
5 5 3 0
6 5 6 0

3 5 6 3
Page Fault Is 6

27 | P a g e
b) Write a C program to simulate the LRU page replacement algorithm

PROGRAM:
#include<stdio.h>

#include<conio.h>
int main()
{
int i, j , k, min, rs[25], m[10], count[10], flag[25], n, f, pf=0, next=1;
printf("Enter the no of pages: ");
scanf("%d",&n);
printf("Enter the page nos: ");

for(i=0;i<n;i++)
{
scanf("%d",&rs[i]);
flag[i]=0;
}
printf("Enter the number of frames: ");

scanf("%d",&f);
for(i=0;i<f;i++)

count[i]=0;
m[i]=-1;
}
printf("\n Page Frames\n");
for(i=0;i<n;i++)
{

for(j=0;j<f;j++)
{

28 | P a g e
if(m[j]==rs[i])
{
flag[i]=1;
count[j]=next;

next++;
}

if(flag[i]==0)
{

if(i<f)

{ m[i]=rs[i];
count[i]=next;
next++;
}
else
{ min=0;

for(j=1;j<f;j++)
if(count[min] > count[j])
min=j;
m[min]=rs[i];
count[min]=next;
next++;

}
pf++;
}
for(j=0;j<f;j++)

29 | P a g e
printf("%d\t", m[j]);
printf("\n");
}
printf("\nNo of page faults using LRU are %d",pf);}

OUTPUT:
Enter the no of pages: 7
Enter the page nos: 1 3 0 3 5 6 3
Enter the number of frames: 3
Page Frames
1 -1 -1
1 3 -1

1 3 0
1 3 0
5 3 0
5 3 6
5 3 6
No of page faults using LRU are 5

30 | P a g e
c)Write a C program to simulatetheLFUpage replacement algorithm
PROGRAM
#include<stdio.h>

int main()

int nf, np, frames[10], pages[30], temp[10], flag1, flag2, flag3, i, j, k, pos, max, faults = 0;

printf("Enter number of frames: ");

scanf("%d", &nf);

printf("Enter number of pages: ");

scanf("%d", &np);

printf("Enter page references: ");

for(i = 0; i< np; ++i){

scanf("%d", &pages[i]);

for(i = 0; i<nf; ++i){

frames[i] = -1;

for(i = 0; i< np; ++i){

flag1 = flag2 = 0;

31 | P a g e
for(j = 0; j <nf; ++j){

if(frames[j] == pages[i]){

flag1 = flag2 = 1;

break;

if(flag1 == 0){

for(j = 0; j <nf; ++j){

if(frames[j] == -1){

faults++;

frames[j] = pages[i];

flag2 = 1;

break;

if(flag2 == 0){

flag3 =0;

for(j = 0; j <nf; ++j){

temp[j] = -1;

for(k = i + 1; k < np; ++k){

if(frames[j] == pages[k]){

32 | P a g e
temp[j] = k;

break;

for(j = 0; j <nf; ++j){

if(temp[j] == -1){

pos = j;

flag3 = 1;

break;

if(flag3 ==0){

max = temp[0];

pos = 0;

for(j = 1; j <nf; ++j){

if(temp[j] > max){

max = temp[j];

pos = j;

33 | P a g e
frames[pos] = pages[i];

faults++;

printf("\n");

for(j = 0; j <nf; ++j){

printf("%d\t", frames[j]);

printf("\n\nTotal Page Faults = %d", faults);

return 0;}

OUTPUT

Enter number of frames: 3

Enter number of pages: 10

Enter page references: 2 3 4 2 1 3 7 5 4 3

2 -1 -1

2 3 -1

2 3 4

2 3 4

1 3 4

1 3 4

7 3 4

5 3 4

34 | P a g e
5 3 4

5 3 4

Total Page Faults = 6

35 | P a g e
EXPERIMENT NO: 07

a)Write a C program to simulatethe Sequenced File allocation strategy

PROGRAM

#include<stdio.h>

void main()

int f[50], i, st, len, j, c, k, count = 0;

for(i=0;i<50;i++)

f[i]=0;

printf("Files Allocated are : \n");

x: count=0;

printf("Enter starting block and length of files: ");

scanf("%d%d", &st,&len);

for(k=st;k<(st+len);k++)

if(f[k]==0)

count++;

if(len==count)

for(j=st;j<(st+len);j++)

if(f[j]==0)

f[j]=1;

printf("%d\t%d\n",j,f[j]);

36 | P a g e
if(j!=(st+len-1))

printf("The file is allocated to disk\n");

else

printf("The file is not allocated \n");

printf("Do you want to enter more file(Yes - 1/No - 0)");

scanf("%d", &c);

if(c==1)

goto x;

OUTPUT

Files Allocated are :

Enter starting block and length of files: 1 3

1 1

2 1

3 1

The file is allocated to disk

Do you want to enter more file(Yes - 1/No - 0)

Enter starting block and length of files: 4 3

4 1

5 1

6 1

The file is allocated to disk

Do you want to enter more file(Yes - 1/No - 0)

37 | P a g e
b)Write a C program to simulatethe Indexed File allocation strategy

PROGRAM

#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

void main()

int f[50], index[50],i, n, st, len, j, c, k, ind,count=0;

for(i=0;i<50;i++)

f[i]=0;

x:printf("Enter the index block: ");

scanf("%d",&ind);

if(f[ind]!=1)

printf("Enter no of blocks needed and no of files for the index %d on the disk : \n", ind);

scanf("%d",&n);

else

printf("%d index is already allocated \n",ind);

goto x;

y: count=0;

for(i=0;i<n;i++)

38 | P a g e
scanf("%d", &index[i]);

if(f[index[i]]==0)

count++;

if(count==n)

for(j=0;j<n;j++)

f[index[j]]=1;

printf("Allocated\n");

printf("File Indexed\n");

for(k=0;k<n;k++)

printf("%d-------->%d : %d\n",ind,index[k],f[index[k]]);

else

printf("File in the index is already allocated \n");

printf("Enter another file indexed");

goto y;

printf("Do you want to enter more file(Yes - 1/No - 0)");

scanf("%d", &c);

if(c==1)

goto x;

39 | P a g e
OUTPUT

Enter the index block: 5

Enter no of blocks needed and no of files for the index 5 on the disk :

1234

Allocated

File Indexed

5-------->1 : 1

5-------->2 : 1

5-------->3 : 1

5-------->4 : 1

Do you want to enter more file(Yes - 1/No - 0)

Enter the index block: 4

4 index is already allocated

Do you want to enter more file(Yes - 1/No - 0) 0

40 | P a g e
c)Write a C program to simulatethe Linked File allocation strategy

PROGRAM
#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

void main()

int f[50], p,i, st, len, j, c, k, a;

for(i=0;i<50;i++)

f[i]=0;

printf("Enter how many blocks already allocated: ");

scanf("%d",&p);

printf("Enter blocks already allocated: ");

for(i=0;i<p;i++)

scanf("%d",&a);

f[a]=1;

x: printf("Enter index starting block and length: ");

scanf("%d%d", &st,&len);

k=len;

if(f[st]==0)

for(j=st;j<(st+k);j++)

41 | P a g e
if(f[j]==0)

f[j]=1;

printf("%d-------->%d\n",j,f[j]);

else

printf("%d Block is already allocated \n",j);

k++;

else

printf("%d starting block is already allocated \n",st);

printf("Do you want to enter more file(Yes - 1/No - 0)");

scanf("%d", &c);

if(c==1)

goto x;

else

exit(0);

OUTPUT

Enter how many blocks already allocated: 3


Enter blocks already allocated: 1 3 5
Enter index starting block and length: 2 4
2-------->1

42 | P a g e
3 Block is already allocated
4-------->1
5 Block is already allocated
6-------->1
7-------->1
Do you want to enter more file(Yes - 1/No - 0)
0

43 | P a g e
EXPERIMENT NO: 08

a)Writea C program to simulate the FCFS disk scheduling algorithm

PROGRAM
#include<stdio.h>

#include<stdlib.h>

int main()

int r[100],i,n,Tst=0,initial;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n");

for(i=0;i<n;i++)

scanf("%d",&r[i]);

printf("Enter initial head position\n");

scanf("%d",&initial);

// logic for FCFS disk scheduling

for(i=0;i<n;i++)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

printf("Total head moment / Total Seek time is %d",Tst);

return 0;

44 | P a g e
}

OUTPUT

Enter the number of Requests

Enter the Requests sequence

82 170 43 140 24 16 190

Enter initial head position

50

Total head moment / Total Seek time is 642

b)Write a C program to simulate,the SCAN disk scheduling algorithm

PROGRAM
#include<stdio.h>

#include<stdlib.h>

int main()

int r[100],i,j,n,Tst=0,initial,size,move;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n");

for(i=0;i<n;i++)

scanf("%d",&r[i]);

45 | P a g e
printf("Enter initial head position\n");

scanf("%d",&initial);

printf("Enter total disk size\n");

scanf("%d",&size);

printf("Enter the head movement direction for high 1 and for low 0\n");

scanf("%d",&move);

// logic for Scan disk scheduling

for(i=0;i<n;i++)

for(j=0;j<n-i-1;j++)

if(r[j]>r[j+1])

int temp;

temp=r[j];

r[j]=r[j+1];

r[j+1]=temp;

int index;

for(i=0;i<n;i++)

46 | P a g e
if(initial<r[i])

index=i;

break;

// if movement is towards high value

if(move==1)

for(i=index;i<n;i++)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

// last movement for max size

Tst=Tst+abs(size-r[i-1]-1);

initial = size-1;

for(i=index-1;i>=0;i--)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

47 | P a g e
// if movement is towards low value

else

for(i=index-1;i>=0;i--)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

// last movement for min size

Tst=Tst+abs(r[i+1]-0);

initial =0;

for(i=index;i<n;i++)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

printf("Total head movement / Total Seek Time is %d",Tst);

return 0;

48 | P a g e
OUTPUT

Enter the number of Requests

Enter the Requests sequence

82 170 43 140 24 16 190

Enter initial head position

50

Enter total disk size

199

Enter the head movement direction for high 1 and for low 0

Total head movement / Total Seek Time is 330

c)Write a C program to simulate the CSCAN disk scheduling algorithm

PROGRAM

#include<stdio.h>

#include<stdlib.h>

int main()

int r[100],i,j,n,Tst=0,initial,size,move;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n");

for(i=0;i<n;i++)

scanf("%d",&r[i]);

49 | P a g e
printf("Enter initial head position\n");

scanf("%d",&initial);

printf("Enter total disk size\n");

scanf("%d",&size);

printf("Enter the head movement direction for high 1 and for low 0\n");

scanf("%d",&move);

// logic for C-Scan disk scheduling

/*logic for sort the request array */

for(i=0;i<n;i++)

for( j=0;j<n-i-1;j++)

if(r[j]>r[j+1])

int temp;

temp=r[j];

r[j]=r[j+1];

r[j+1]=temp;

int index;

50 | P a g e
for(i=0;i<n;i++)

if(initial<r[i])

index=i;

break;

// if movement is towards high value

if(move==1)

for(i=index;i<n;i++)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

// last movement for max size

Tst=Tst+abs(size-r[i-1]-1);

/*movement max to min disk */

Tst=Tst+abs(size-1-0);

initial=0;

for( i=0;i<index;i++)

Tst=Tst+abs(r[i]-initial);

51 | P a g e
initial=r[i];

// if movement is towards low value

else

for(i=index-1;i>=0;i--)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

// last movement for min size

Tst=Tst+abs(r[i+1]-0);

/*movement min to max disk */

Tst=Tst+abs(size-1-0);

initial =size-1;

for(i=n-1;i>=index;i--)

Tst=Tst+abs(r[i]-initial);

initial=r[i];

printf("Total head movement is %d",Tst);

return 0;}

52 | P a g e
OUTPUT

Enter the number of Requests

Enter the Requests sequence

82 170 43 140 24 16 190

Enter initial head position

50

Enter total disk size

199

Enter the head movement direction for high 1 and for low 0

Total head movement is 364

d)Write a C program to simulate the SSTF disk scheduling algorithm

PROGRAM
#include<stdio.h>

#include<stdlib.h>

int main()

int r[100],i,n,Tst=0,initial,count=0;

printf("Enter the number of Requests\n");

scanf("%d",&n);

printf("Enter the Requests sequence\n");

for(i=0;i<n;i++)

scanf("%d",&r[i]);

53 | P a g e
printf("Enter initial head position\n");

scanf("%d",&initial);

// logic for sstf disk scheduling

/* loop will execute until all process is completed*/

while(count!=n)

int min=1000,d,index;

for(i=0;i<n;i++)

d=abs(r[i]-initial);

if(min>d)

min=d;

index=i;

Tst=Tst+min;

initial=r[index];

// 1000 is for max

// you can use any number

r[index]=1000;

count++;

printf("Total head movement is %d",Tst);

return 0;

54 | P a g e
}

OUTPUT

Enter the number of Requests

Enter the Requests sequence

82 170 43 140 24 16 190

Enter initial head position

50

Total head movement is 208

55 | P a g e
PART-B (SOFTWARE ENGINEERING)

EXPERIMENT NO:01
DRAW E-R DIAGRAMS, DFD FOR THE PROJECT.
ER DIAGRAMS:
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. In ER modelling, the
database structure is portrayed as a diagram called an entity-relationship diagram.
ENTITY:

An entity may be any object, class, person or place. In the ER diagram, an entity can be
represented as rectangles.
EX: Consider an organization as an example- manager, product, employee, department etc. can
be taken as an entity.

56 | P a g e
ATTRIBUTE:

The attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.
EX:id, age, contact number, name, etc. can be attributes of a student.

RELATIONSHIP:
A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.
EX:

Types of relationship are as follows:

a. One-to-One Relationship: When only one instance of an entity is associated with the
relationship, then it is known as one-to-one relationship.
EX: A female can marry to one male, and a male can marry to one female.

b. One-to-many relationship: When more than one instance of the entity on the left, and
only one instance of an entity on the right associates with the relationship then it is
known as a many-to-one relationship.

57 | P a g e
EX: Scientist can invent many inventions, but the invention is done by the only
specific scientist.

c. Many-to-one relationship: When more than one instance of the entity on the left, and
only one instance of an entity on the right associates with the relationship then it is
known as a many-to-one relationship. EX: Student
enrolls for only one course, but a course can have many students.

d. Many-to-many relationship: When more than one instance of the entity on the left, and
more than one instance of an entity on the right associates with the relationship then it is
known as a many-to-many relationship.
EX:Employee can assign by many projects and project can have many employees.

58 | P a g e
Course Registration System:
The course registration system helps the students to gather information about a particular course
and then they can easily register themselves in a particular course.
This ER (Entity Relationship) Diagram represents the model of Course Registration System
Entity. The entity-relationship diagram of Course Registration System shows all the visual
instrument of database tables and the relations between Fees, Students, Course, Trainers etc.
Course Registration System entities and their attributes:
Course Entity: Attributes of Course are course_id, course_student_id, course_registration,
course_name, course_type, course_year, course_description)
Fees Entity: Attributes of Fees are fees_id, fees amount, fees_type, fees_description
Syllabus Entity: Attributes of Syllabus are syllabus_id, syllabus_course_id, syllabus_name,
syllabus_type, syllabus_description
Students Entity: Attributes of Students are student_id, student_college_id, student_name,
student_mobile, student_email, student_username, student password, student_address
Registrations Entity: Attributes of Registrations are registration_id, registration_student_id,
registration_name, registration_type, registration_number, registration_date,
registration_description
Trainers Entity: Attributes of Trainers are trainer_id, trainer_course_id, trainer_name,
trainer_mobile, trainer_email, trainer_usemame, trainer_password, trainer_address

59 | P a g e
Students Marks Analyzing System:
Student mark analyzing system has been designed to carry out the mark analysis process in an
educational institution. The results of respective departments can be efficiently computed without
much of manual involvement. This ER (Entity Relationship) Diagram represents the model of
Students Marks Analyzing System Entity The entity-relationship diagram of Students Marks
Analyzing System shows all the visual instrument of database tables and the relations between
Class Exam, Student Teacher etc.
Result Management System entities and their attributes:
Student Entity: Attributes of Student are student_id, student_college_id, student_name, student
mobile, student email, student username, student password, student address
Class Entity: Attributes of Class are class id, class student id, class name, class room, class type,
class description
Subject Entity: Attributes of Subject are subject id, subject_course_id, subject student_id,
subject_name, subject type, subject_description
Exam Entity: Attributes of Exam are exam id, exam student_id, exam roll number,
exam_dateexam_name, exam_typeexam_description Result Entity Attributes of Result are result
id, result student_id, result_name, result_description
Teacher Entity: Attributes of Teacher are teacher_id, teacher_college_id, teacher_name,
teacher_mobile, teacher_email, teacher_username teacher password, teacher address

60 | P a g e
Online Ticket Reservation System: An
online reservation system is a software solution that allows customers to book their reservations
or appointments online via a company's website or app instead of over the phone or in person.
This ER (Entity Relationship) Diagram represents the model of Ticket Reservation System
Entity. The entity-relationship diagram of Ticket Reservation System shows all the visual
instrument of database tables and the relations between Seats Availability, Stations, Trains,
Passengers etc.

Ticket Reservation System entities and their attributes:


Trains Entity: Attributes of Trains are train_id, train_name, train_number, train seat number,
train ticket, train_type, train_description
Seats AvailabilityEntity: Attributes of Seats Availability are seat_id, seat_train_id,
seat_customer_id, seat_number, seat_type, seat_description
Fare Entity: Attributes of Fare are fare_id, fare_ticket_id, fare_title, fare_type, fare_description
Stations Entity: Attributes of Stations are station_id, station_name, station_type, station
description. Booking Entity: Attributes of Booking are booking_id, booking_ticket_id,
booking_title, booking type, booking_date, booking_description

61 | P a g e
Passengers Entity: Attributes of Passengers are passenger_id,passenger_name,
passenger_mobile,passenger_email,passenger_username,passenger_password,passenger_address

Stock Maintenance:
This ER (Entity Relationship) Diagram represents the model of Stock Management System
Entity The entity relationship diagram of Stock Management System shows all the visual
instrument of database tables and the relations between Product Bill, Stock, Store etc.
Stock Management System entities and their attributes:
Stock Entity: Attributes of Stock are stock_id, stock items, stock number, stock_type,
stock_description
Product Entity: Attributes of Product are product_id, product_customer_id product items,
product number, product type product description
Product Quality: Entity Attributes of Product Quality are product
quality_idproduct_quality_name, product quality_type product quality description
Bill Entity: Attributes of Bill are bill_id, bill customer_idbill_number, bill type, bill receipt,
bill_description
Customer Entity: Attributes of Customer are customer_id,customer_name, customer_mobile,
customer email, customer_usemame customer password, customer_address
Store Entity: Attributes of Store are store_id, store_name, store type, store_description

62 | P a g e
DATA FLOW DFD:
A data flow diagram (DFD) maps out the flow of information for any process or system. It uses
defined symbols like rectangles, circles and arrows, plus short text labels, to show data inputs,
outputs, storage points and the routes between each destination. They can be used to analyze an
existing system or model a new one. For each data
flow, at least one of the endpoints (source and / or destination) must exist in a process. The
refined representation of a process can be done in another data-flow diagram, which subdivides
this process into sub-processes. The data-flow diagram is a tool that is part of structured
analysis and data modeling.

63 | P a g e
SYMBOLS AND NOTATIONS USED IN DFDS :
Using any convention’s DFD rules or guidelines, the symbols depict the four components of data
flow diagrams.

NOTATION COMPONENTS SYMBOLS


NN

64 | P a g e
Function/Process: any process that changes the data, producing an output. It might perform
computations, or sort data based on logic, or direct the data flow based on business rules. A short
label is used to describe the process, such as “Submit payment.”

Database/Data store: files or repositories that hold information for later use, such as a database
table or a membership form. Each data store receives a simple label, such as “Orders.”

(Input/Output)/Externalentity: an outside system that sends or receives data, communicating


with the system being diagrammed. They are the sources and destinations of information
entering or leaving the system. They might be an outside organization or person, a computer
system or a business system. They are also known as terminators, sources and sinks or actors.
They are typically drawn on the edges of the diagram.

Flow/Data flow: the route that data takes between the external entities, processes and data stores.
It portrays the interface between the other components and is shown with arrows, typically
labeled with a short data name, like “Billing details.”

RULES FOR DATA FLOW DIAGRAM:


1) Data cannot flow between two entities.
Data flow must be from entity to a process or a process to an entity. There can be multiple data
flows between one entity and a process.
2) Data cannot flow between two data stores.
Data flow must be from data store to a process or a process to an data store. Data flow can occur
from one data store to many process.
3) Data cannot flow directly from an entity to data store.
Data Flow from entity must be processed by a process before going to data store and vice versa.
4) A process must have atleast one input data flow and one output data flow.
Every process must have input data flow to process the data and an output data flow for the
processed data.
5) A data store must have atleast one input data flow and one output data flow.
Every data store must have input data flow to store the data and an output data flow for the
retrieved data.
6) Two data flows cannot cross each other.
7) All the process in the system must be linked to minimum one data store or any other
process.

65 | P a g e
LEVELS IN DATA FLOW DIAGRAMS (DFD):
DFD(data flow diagram) can be drawn to represent the system of different levels of abstraction.
Higher-level DFDs are partitioned into low levels-hacking more information and functional
elements. Levels in DFD are numbered 0, 1, 2. The main 3 levels in the data flow diagram, are:
0-level DFD, 1-level DFD, and 2-level DFD.

0-level DFD:
It is also known as a context diagram. It’s designed to be an abstraction view, showing the
system as a single process with its relationship to external entities. It represents the entire system
as a single bubble with input and output data indicated by incoming/outgoing arrows.

1-level DFD:
In 1-level DFD, the context diagram is decomposed into multiple bubbles/processes. In this
level, we highlight the main functions of the system and breakdown the high-level process of 0-
level DFD into subprocesses.

2-level DFD:
2-level DFD goes one step deeper into parts of 1-level DFD. It can be used to plan or record the
specific/necessary detail about the system’s functioning.

Progression to level 3, 4 and more is possible, but usually going beyond level 3 is rare.

COURSE REGISTRATION SYSTEM:


The course registration system helps the students to gather information about a particular course
and then they can easily register themselves in a particular course.
LEVEL-0:

66 | P a g e
LEVEL-1:

LEVEL-2:

67 | P a g e
68 | P a g e
STUDENTS MARKS ANALYZING SYSTEM:

Student mark analyzing system has been designed to carry out the mark analysis process in an
educational institution. The results of respective departments can be efficiently computed
without much of manual involvement.

LEVEL-0:

LEVEL-1:

LEVEL-2:

69 | P a g e
70 | P a g e
ONLINE TICKET RESERVATION SYSTEM:
An online reservation system is a software solution that allows customers to
book their reservations or appointments online via a company's website or app instead of over
the phone or in person.

LEVEL-0:

LEVEL-1:

71 | P a g e
LEVEL-2:

72 | P a g e
73 | P a g e
STOCK MAINTENANCE:
Stock management is the practice of ordering, storing, tracking, and controlling inventory.
LEVEL-0:

LEVEL-1:

LEVEL-2:

74 | P a g e
75 | P a g e
EXPERIMENT NO: 02
DRAW UML DIAGRAMS FOR THE PROJECT.

UML:
The Unified Modelling Language (UML) is a graphical language for OOAD that gives a
standard way to write a software system’s blueprint. It helps to visualize, specify, construct, and
document the artifacts of an object-oriented system. It is used to depict the structures and the
relationships in a complex system.

Brief History
It was developed in 1990s as an amalgamation of several techniques, prominently OOAD
technique by Grady Booch, OMT (Object Modelling Technique) by James Rumbaugh, and
OOSE (Object Oriented Software Engineering) by Ivar Jacobson. UML attempted to standardize
semantic models, syntactic notations, and diagrams of OOAD.

Basic Building Blocks (The three building blocks of UML):


 Things
 Relationships
 Diagrams

1) THINGS: There are four kinds of things in UML, namely:


 Structural Things: These are the nouns of the UML models representing the
static element that may be either physical or conceptual. The structural things are
class, interfaceetc
 Behavioral Things: These are the verbs of the UML models representing the
dynamic behavior over time and space
 Grouping Things: They comprise the organizational parts of the UML models.
There is only one kind of grouping thing, i.e., package.
 Annotational Things: These are the explanations in the UML models
representing the comments applied to describe elements.

2) RELATIONSHIPS: Relationships are the connection between things. The four types of
relationships that can be represented in UML are:
 Dependency: This is a semantic relationship between two things such that a
change in one thing brings a change in the other
 Association: This is a structural relationship that represents a group of links
having common structure and common behavior.
 Generalization: This represents a generalization/specialization relationship in
which subclasses inherit structure and behavior from super-classes.
 Realization: This is a semantic relationship between two or more classifiers such
that one classifier lays down a contract that the other classifiers ensure to abide
by.

76 | P a g e
3) DIAGRAMS: A diagram is a graphical representation of a system. It comprises of a group
of elements generally in the form of a graph. UML includes nine diagrams in all, namely:

i. Class Diagram
ii. Use Case Diagram
iii. Sequence Diagram
iv. State Chart Diagram
v. Activity Diagram
vi. Object Diagram
vii. Component Diagram
viii. Deployment Diagram

 Class Diagram: A class diagram models the static view of a system. It comprises of the
classes, interfaces, and collaborations of a system; and the relationships between them.

 Use Case Diagram: Use case diagrams comprise of:

 Use cases
 Actors
 Relationships like dependency, generalization, and association
Use case: A use case describes the sequence of actions a system performs yielding
visible results. It shows the interaction of things outside the system with the system
itself. Use cases may be applied to the whole system as well as a part of the system.
Actor: An actor represents the roles that the users of the use cases play. An actor may
be a person (e.g. student, customer), a device (e.g. workstation)

77 | P a g e
 Sequence Diagram: Sequence diagrams are interaction diagrams that illustrate the
ordering of messages according to time.

 State–Chart Diagrams: A state–chart diagram shows a state machine that depicts the
control flow of an object from one state to another. State-chart diagrams are used for
modeling objects which are reactive in nature.

 Activity Diagrams: An activity diagram depicts the flow of activities which are ongoing
non-atomic operations in a state machine. Activities result in actions which are atomic
operations.

78 | P a g e
COURSE REGISTRATION SYSTEM :
The course registration system helps the students to gather information about a particular course
and then they can easily register themselves in a particular course.

USECASE:

79 | P a g e
SEQUENCE DIAGRAM:

STATECHART:

80 | P a g e
81 | P a g e
ACTIVITY DIAGRAM:

82 | P a g e
CLASS DIAGRAM:

83 | P a g e
MARKS ANALYSING SYSTEM:
USECASE:

84 | P a g e
SEQUENCE:

85 | P a g e
STATE CHART:

86 | P a g e
ACTIVITY DIAGRAM:

87 | P a g e
CLASS DIAGRAM:

88 | P a g e
ONLINE TICKET RESERVATION SYSTEM:
USECASE:

89 | P a g e
SEQUENCE:

90 | P a g e
STATE CHART:

91 | P a g e
ACTIVITY DIAGRAM:

92 | P a g e
CLASS DIAGRAM:

93 | P a g e
STOCK MAINTENANCE SYSTEM:

USECASE:

SEQUENCE DIAGRAM:

94 | P a g e
STATE CHART DIAGRAM:

95 | P a g e
ACTIVITY DIAGRAM:

96 | P a g e
CLASS DIAGRAM:

97 | P a g e
EXPERIMENT NO: 03

DESIGN THE TEST CASES FOR E-COMMERCE APPLICATION (FLIPKART,


AMAZON)

TEST CASES:
A Test Case is a set of actions executed to verify a particular feature or functionality of your
software application, it contains test steps, test data, precondition, postcondition developed for
specific test scenario to verify any requirement.
The test case includes specific variables or conditions, using which a testing engineer can
compare expected and actual results to determine whether a software product is functioning as
per the requirements of the customer.

How to Write Test Cases in Manual Testing


 Test Case ID:
Test cases should all bear unique IDs to represent them. In most cases, following a convention
for this naming ID helps with organization, clarity, and understanding.
 Test Description:
This description should detail what unit, feature, or function is being tested or what is being
verified.
 Steps to be Executed:
These should be easily repeatable steps as executed from the end user’s perspective.
For example, a test case for logging into an email server might include these steps:
1. Open email server web page.
2. Enter username.
3. Enter password.
4. Click “Enter” or “Login” button.

 Expected Result:
This indicates the result expected after the test case step execution. Upon entering the right login
information, the expected result would be a successful login.
 Actual Result and Post-Conditions
As compared to the expected result, we can determine the status of the test case. In the case of
the email login, the user would either be successfully logged in or not. The post-condition is
what happens as a result of the step execution such as being redirected to the email inbox.
 Pass/Fail
Determining the pass/fail status depends on how the expected result and the actual result
compare to each other.
Same result = Pass
Different results = Fail
 ns and Pre-Conditions:

98 | P a g e
This entails any conditions to be met before test case execution. One example would be requiring
a valid Outlook account for a login.
 Test Data:
This relates to the variables and their values in the test case. In the example of an email login, it
would be the username and password for the account.
ECOMMERCE APPLICATION(AMAZON & FLIPKART) TEST CASES:
The e-commerce business is increasing at a rapid pace especially since Covid.
So it is very important to test e-commerce websites and applications such as Amazon and
Flipkart. Regressive testing of e-commerce applications is vital to make your app more robust
and secure.
Effective manualtest strategies should be designed to test eCommerce applications.
ECOMMERCE APPLICATION ARCHITECTURE
An eCommerce application has 4 important elements –
 Main Pages: It includes homepage, privacy page, about us page, careers, etc.
 Product Pages: It includes different options for the product such as size, color, and other
attributes.
 Product Description Pages: It includes title, description, images, add to cart feature and
additional info, etc.
 Shopping Cart: The shopping cart page should include payment options and removing a
product from the cart.
an eCommerce website or an application includes different user roles such as customers,
partners, staff, and service agents. Backend infrastructures include rules, analytics, security,
logging, and content management.
Core Functionality includes Content, Marketing, Inventory Management, Orders, and Catalog.
Back-office functionality includes fulfillment, inventory, payment, and Catalog staging.
Core Functionality includes Content, Marketing, Inventory Management, Orders, and Catalog.
Back-office functionality includes fulfillment, inventory, payment, and Catalog staging.\

99 | P a g e
EXPECTED ACTUAL
TC-ID TC-NAME STEPS INPUT DATA STATUS
RESULT RESULT

LOGIN FUNTIONALITY IN ECOMMERCE APPLICATION

100 | P a g e
Username: It should accept
Valid 1)Enter valid username
TC-01 shariff@gmail. username Accepting PASS
Username
Com

Username: It should not


Invalid 1)Enter Invalid username shariff@gmail.
TC-02 accept username Accepting FAIL
Username
Com
1)Enter valid password
2)password should
Valid Password: It should accept
TC-03 contain combination od Accepting PASS
password CSM@231 password
no. of char & special
symbol
1)Enter Invalid password
2)password should Password: It should accept
Invalid
TC-04 contain combination od CSM@231 password Accepting FAIL
password
no. of char & special
symbol
TC-05
It should go to Going to
Submit 1)click on Submit Button NO INPUT next page PASS
next page

TC-06
It should not go to Not Going
Submit 1)click on Submit Button NO INPUT next page FAIL
to next page

It should clear
TC-07
username & Clearing
Cancel 1)click on cancel Button NO INPUT password and and on same PASS
remain on same page
page
It should not clear
TC-08
username & Not clearing
Cancel 1)click on cancel Button NO INPUT password and not and not on FAIL
remain on same the same
page page

101 | P a g e
EXPERIMENT NO: 04
DESIGN THE TEST CASES FOR MOBILE APPLICATION (CONSIDER ANY
EXAMPLE FROM APP STORE)

FUNCTIONAL TESTING:
The Functional Testing of Mobile Application is a process of testing functionalities of mobile
applications like user interactions as well as testing the transactions that users might perform.
The main purpose of mobile application functional testing is to ensure the quality, meeting the
specified expectations, reducing the risk or errors and customer satisfaction.
The various factors which are relevant in functional testing are:
 Type of application based upon the business functionality usages (banking, gaming,
social or business)
 Target audience type (consumer, enterprise, education)
Distribution channel which is used to spread the application (e.g. Apple App Store, Google
play, direct distribution)
The general test scenarios for Functional Testing in a Mobile application are:
1. To validate whether all the required mandatory fields are working as required.
2. To validate that the mandatory fields are displayed in the screen in a distinctive way than
the non-mandatory fields.
3. To validate whether the application works as per as requirement whenever the application
starts/stops.
4. To validate whether the application goes into minimized mode whenever there is an
incoming phone call. In order to validate the same we need to use a second phone, to call
the device.
PERFORMANCE TESTING:
This type of testing’s fundamental objective is to ensure that the application performs acceptably
under certain performance requirements such as access by a huge number of users or the removal
of a key infrastructure part like a database server.
The general test scenarios for Performance Testing in a Mobile application are:
1. To determine whether the application performs as per the requirement under different
load conditions.
2. To determine whether the current network coverage is able to support the application at
peak, average and minimum user levels.
3. To validate whether the response time of the application is as per as the requirements.
4. To validate that the battery consumption, memory leaks, resources like GPS, Camera
performance is well within required guidelines.
5. To validate the application longevity whenever the user load is rigorous.
6. To validate the network performance while moving around with the device.SECURITY
TESTING TEST CASES:

102 | P a g e
The fundamental objective of security testing is to ensure that the application’s data and
networking security requirements are met as per guidelines.
The following are the most crucial areas for checking the security of Mobile applications.

The general test scenarios for security testing in a Mobile application are:
1. To validate that the application is able to withstand any brute force attack which is an
automated process of trial and error used to guess a person’s username, password or
credit-card number.
2. To validate whether an application is not permitting an attacker to access sensitive
content or functionality without proper authentication.
3. To validate that the application has a strong password protection system and it does not
permit an attacker to obtain, change or recover another user’s password.
4. To validate that the application does not suffer from insufficient session expiration.
5. To identify the dynamic dependencies and take measures to prevent any attacker for
accessing these vulnerabilities.
6. To protect the application and the network from the denial of service attacks.
7. To analyze the data storage and data validation requirements.
8. To protect against malicious client side injections.
9. To protect against malicious runtime injections.

USABILITY TESTING TEST CASES:


The usability testing process of the Mobile application is performed to have a quick and easy
step application with less functionality than a slow and difficult application with many features.
The main objective is to ensure that we end up having an easy-to-use, intuitive and similar to
industry-accepted interfaces which are widely used.
The general test scenarios for usability testing in a Mobile application are:
1. To ensure that the buttons should have the required size and be suitable to big fingers.
2. To ensure that the buttons are placed in the same section of the screen to avoid confusion
to the end users.
3. To ensure that the icons are natural and consistent with the application.
4. To ensure that the buttons, which have the same function should also have the same
color.
5. To ensure that the validation for the tapping zoom-in and zoom-out facilities should be
enabled.
6. To ensure that the text is kept simple and clear to be visible to the users.
7. To ensure that the short sentences and paragraphs are readable to the end users.
8. To ensure that the font size is big enough to be readable and not too big or too small.
9. To validate the application prompts the user whenever the user starts downloading a large
amount of data which may be not conducive for the application performance.
10. To validate that the closing of the application is performed from different states and verify
if it re-opens in the same state.

103 | P a g e
COMPATIBILITY TESTING TEST CASES:
Compatibility testing on mobile devices is performed to ensure that since mobile devices have
different size, resolution, screen, version and hardware so the application should be tested across
all the devices to ensure that the application works as desired.
The general test scenarios for compatibility testing in a Mobile application are:
1. To validate that the user Interface of the application is as per the screen size of the device,
no text/control is partially invisible or inaccessible.
2. To ensure that the text is readable for all users for the application.
3. To ensure that the call/alarm functionality is enabled whenever the application is running.
The application is minimized or suspended on the event of a call and then whenever the
call stops the application is resumed.

RECOVERABILITY TESTING TEST CASES:

The general test scenarios for recoverability testing in a Mobile application are:

1. Crash recovery and transaction interruptions


2. Validation of the effective application recovery situation post unexpected
interruption/crash scenarios.
3. Verification of how the application handles a transaction during a power failure (i.e.
Battery dies or a sudden manual shutdown of the device)
4. The validation of the process where the connection is suspended, the system needs to re-
establish for recovering the data directly affected by the suspended connection.

Important Checklist
1. Installation testing (whether the application can be installed in a reasonable amount of
time and with required criterion)
2. Uninstallation testing (whether the application can be uninstalled in a reasonable
amount of time and with required criterion)
3. Network test cases (validation of whether the network is performing under required load
or not, whether the network is able to support all the necessary applications during the
testing procedures)
4. Check Unmapped keys
5. Check application splash screen
6. Continued keypad entry during interrupts and other times like network issues
7. Methods which deal with exiting the application
8. Charger effect while an application is running in the background
9. Low battery and high-performance demand
10. Removal of battery while an application is being performed
11. Consumption of battery by application

104 | P a g e
TEST EXPECTED ACTUAL
STATUS STEPS STATUS
CONDITION RESULT RESULT
1)download and install Mobile app should
mobile app open with in
Verify mobile 2)open mobile app first registration links.
DESIGN app registration time NOT RUN N/A
screen

1)download and install Registration link


12. Check Application side effects

mobile app should display


2)open mobile app first name, mobile no,
Verify time email ID, password,
DESIGN registration 3)click on registration continue button NOT RUN N/A
screen link

105 | P a g e
1)download and install Name field should
mobile app be
2)open mobile app first
TYEP: Test box
DESIGN Verifyname field time ACCEPT: Min 3 NOT RUN N/A
3)click on registration
and max 16
link alphabets
4)verify name field VALIDATION:
should provide
1)mobile app Email id field
validation message
download & install should be
if field is empty
2)open mobile app first TYPE: test box
while click on
Verify Email id time Accepts: email ID
DESIGN continue NOT RUN N/A
field 3)click on registration format
link
4)enter name
5)verify email
1)mobile
EXPECTED no field ACTUAL
STEPS should be STATUS TC-ID TYPE
RESULT RESULT
1)Download & Install TYPE: text box
mobile app ACCEPTS:only
2)open mobile app first numeric
time MAX: 10 digits
3)Click on registration VALIDATION: NOT RUN N/A TC-01 SANITY
link should provide
4)Enter name validation
5)Enter Email no. message
1)PASSWORDif field is
6)Verify
1)Download mobile
&number
install empty
field should
whilebeclick
mobile app on
ACCEPTS: continue
2)Open mobile app first button
password
time encrypted all
3)Click registration link characters
NOT RUN N/A TC-02 SANITY
4)Enter name VALIDATION:
5)Enter email ID if empty should
6)Enter mobile number provide validation

106 | P a g e
7)Enter the password message while
1)Download&Install
field 1)mobile
click on continueapp
mobile app should
button redirect
2)Open mobile app for page in order to
first time login with
3)Click on registration Facebook existing
NOT RUN N/A TC-03 MANUAL
link account
4)Click on facebook link 2)should display
accept

1)mobile app
should redirect
google page in
Click on Google link NOT RUN N/A TC-04 MANUAL
order to login with
google existing
account
TEST
TC-ID TYPE STATUS
CONDITION

Verify mobile
TC-05 MANUAL DESIGN
number field

Verify password
TC-06 MANUAL DESIGN
field

107 | P a g e
Verify Facebook
TC-07 MANUAL DESIGN
link

TC-08 MANUAL DESIGN Verify page link


EXPERIMENT NO: 05

DESIGN AND IMPLEMENT ATM SYSTEM THROUGH UML DIAGRAMS.

These are the UML diagrams of ATM System which shows the flows between the Balance,
Accounts, Customer Employees, Fixed Deposit.

The main activity involved in this UML Activity Diagram of Banking Management System are
as follows
 BALANCE ACTIVITY
 ACCOUNTS ACTIVITY
 CUSTOMER ACTIVITY
 EMPLOYEES ACTIVITY
 FIXED DEPOSIT ACTIVITY

USECASE DIAGRAM:

108 | P a g e
SEQUENCE DIAGRAM:

109 | P a g e
STATECHART DIAGRAM:

110 | P a g e
ACTIVITY DIAGRAM:

111 | P a g e
CLASS DIAGRAM:

112 | P a g e

You might also like