Se & CN Lab
Se & CN Lab
Se & CN Lab
Martin's Engineering
College UGC Autonomous
NBA & NAAC A+ Accredited
Dhulapally, Secunderabad-500 100
www.smec.ac.in
LAB MANUAL
YEAR : 2023-24
REGULATION : R22
INDEX
3 Syllabus
4 List of Experiments
5 Programs
Mission of the Institute trends in industry and to invoke the desire of innovation as a process
of life•long learning for a successful career in engineering and
management.
Course Outcomes
To prepare students to fit into any industry associated with developing and
PEO3
implementation of software products or technologies.
To equip the graduates with ability to analyze, design and test the novel
PEO4
products.
Course Outcomes
1. Develop the application specific codes using python.
2. Understand Strings, Lists, Tuples and Dictionaries in Python
3. Verify programs using modular approach, file I/O, Python standard library
4. Implement Digital Systems using Python
5. To be able to work with different network tools
List of Experiments
Software Engineering List of Experiments:
1. Development of problem statements.
2. Preparation of Software Requirement Specification Document, Design Documents and
Testing Phase related documents.
3. Preparation of Software Configuration Management and Risk Management related
documents
4. Study and usage of any Design phase CASE tool
5. Performing the Design by using any Design phase CASE tools.
6. Develop test cases for unit testing and integration testing
7. Develop test cases for various white box and black box testing techniques.
Sample Projects: 1. Passport automation System 2. Book Bank 3. Online Exam
Registration
Users Characteristics:
Student: They are the people who desire to obtain the books and submit the information to the
database.
Librarian: He has the certain privileges to add the books and to approval of the reservation of books.
System Modules:
Log in: Secure registration of student and librarian by filling online registration form.
Book bank: Book bank contains all the books. New book added to the book bank with bookno, title
name, author, edition, publisher name details to the database. Any book is deleted if damaged. Update
of the book information also done.
Operations: student and administrator perform their operations like add book, delete book, update
information, view book details are implemented in log in WebPages.
Non-functional requirements:
Privacy: privacy maintained for each and every user by providing user credentials username and
password.
Hardware Requirements:
Processor:i3 or higher
RAM : 4 GB
Star UML is a UML (Unified Modeling Language) tool, introduce by MKLab. It is an open-source
modeling tool that supports the UML framework for system and software modeling. StarUML
is based on UML version 1.4, it provides 11 different types of diagram and it accepts UML 2.0
notation. Version 2.0 was released for beta testing under a property license.
StarUML is mostly used by the Agile and small development teams, professional persons and
used by the educational institutes
2.Class Diagram
3.Sequence Diagram
4.Collaboration Diagram
5.Statechart Diagram
6.Component Diagram
7.Deployment Diagram
Features of StarUML
Step 3: There will be 3 Operating Systems (OS) options, click on the option as per the devise
OS.
Step 4: Now, right-click on the downloaded file, select “Show in Folder” option.
Step 5: Click on the open file, a popup window opens, click on the “Yes” button.
Step 6: Installation gets start. After installation popup opens to ask to buy a license. If you
want to click on the “Buy Now” button or else close that window. StarUML is ready to use.
Use_Case Diagram:
The book bank use cases are:
1. book_issue
2. book_return
3. book_order
4. book_entry
5. search book_details
10
Actors Involved:
1. Student
11
2. Librarian
3. Vendor
Usecase Name : Search Book_Details
The librarian initiates this use case when any member returns or request the book and checking if the
book is available.
Precondition: The librarian should enter all Book details.
Normal Flow: Build message for librarian who search the book.
Post Condition: Send message to respective member who reserved the book.
13
Post Condition: Check the status of reservation.
Activity Diagram:
Activity diagrams are graphical representations of workflows of stepwise activities and actions with
14
support for choice, iteration and concurrency. In the Unified Modeling Language, activity diagrams
can be used to describe the business and operational step-by-step workflows of components in a
system. An activity diagram shows the overall flow of control. An activity is shown as an rounded
box containing the name of the operation.
This activity diagram describes the behaviour of the system.
15
Figure 3. Activity Diagram for Book Bank System [order book]
16
Figure 4. Activity Diagram for Book Bank System [Return book]
Sequence Diagram:
A sequence diagram represents the sequence and interactions of a given USE-CASE or scenario.
Sequence diagrams can capture most of the information about the system. Most object to object
interactions and operations are considered events and events include signals, inputs, decisions, interrupts,
transitions and actions to or from users or external devices.
An event also is considered to be any action by an object that sends information. The event line
represents a message sent from one object to another, in which the “form” object is requesting an
operation be performed by the “to” object. The “to” object performs the operation using a method that the
class contains.
17
It is also represented by the order in which things occur and how the objects in the system send
message to one another.
18
Figure 5. Sequence Diagram For Book Issue & Return
Class Diagram:
The class diagram, also referred to as object modeling is the main static analysis diagram. The main
task of object modeling is to graphically show what each object will do in the problem domain. The
problem domain describes the structure and the relationships among objects.
19
The ATM system class diagram consists of four classes:
1. Student
2. Book
3. Issue
4. Return
5. Vendor
6. Details
1) Student:
It consists of twelve attributes and three operations. The attributes are enrollno, name, DOB,
fathername, address, dept name, batch and book limits. The operations of this class are addStInfo(),
deleteStInfo(), modifyStInfo().
2) Book:
It consists of ten attributes and four operations. This class is used to keep book information such as
author, title, vendor, price, etc
3) Issue:
It consists of eight attributes and two operations to maintain issue details such as, issue date, accno of
issued book, name of the student who borrowed book.
4) Return:
It consists of eight attributes and two operations to maintain issue details such as, issue date, accno of
issued book, name of the student who borrowed book.
5) Students:
The attributes of this class are name, dept ,year ,bcode no The operation is display students().
6) Detail:
20
The attributes of this class are book name, author, bcode no The operations are delete details().
21
Figure 8. State Chart Diagram for BookBank System
Deployment diagrams are used to visualize the topology of the physical components of a system where
the software components are deployed.
22
3. Develop test cases for unit testing and integration testing
4. Develop test cases for various white box and black box testing
techniques.
23
24
25
26
27
5. Preparation of Software Requirement Specification Document:
Student: They are the people who desire to obtain the books and submit the information to
the database.
Librarian: He has the certain privileges to add the books and to approval of the reservation of
books.
System Modules:
Log in: Secure registration of student and librarian by filling online registration form.
Book bank: Book bank contains all the books. New book added to the book bank with
bookno, title name, author, edition, publisher name details to the database. Any book is
deleted if damaged. Update of the book information also done.
Operations: student and administrator perform their operations like add book, delete book,
update information, view book details are implemented in log in WebPages.
Non-functional requirements:
Privacy: privacy maintained for each and every user by providing user credentials username
and password.
Software Requirements:
Hardware Requirements:
28
Processor:i3 or higher
RAM : 4 GB
StarUML is mostly used by the Agile and small development teams, professional persons and
used by the educational institutes
2. Class Diagram
3. Sequence Diagram
4. Collaboration Diagram
5. Statechart Diagram
29
6. Component Diagram
7. Deployment Diagram
Features of StarUML
Step 4: Now, right-click on the downloaded file, select “Show in Folder” option.
Step 5: Click on the open file, a popup window opens, click on the “Yes” button.
Step 6: Installation gets start. After installation popup opens to ask to buy a license. If you
want to click on the “Buy Now” button or else close that window. StarUML is ready to use.
Use_Case Diagram:
The book bank use cases are:
1. book_issue
2. book_return
3. book_order
4. book_entry
5. search book_details
Actors Involved:
1. Student
2. Librarian
3. Vendor
31
Usecase Name : Search Book_Details
The librarian initiates this use case when any member returns or request the book and checking if the
book is available.
33
Usecase Name : Book_Entry
The purchase book use-case when new books invoke it or magazines are added to the library.
Precondition: Not available or more copies are required.
Normal Flow: Enter bookid,author information, publication information, purchased date, prize and
number of copies.
Post Condition: Update the information in catalogue.
Activity Diagram:
Activity diagrams are graphical representations of workflows of stepwise activities and actions with
support for choice, iteration and concurrency. In the Unified Modeling Language, activity diagrams
34
can be used to describe the business and operational step-by-step workflows of components in a
35
system. An activity diagram shows the overall flow of control. An activity is shown as an rounded
box containing the name of the operation.
This activity diagram describes the behaviour of the system.
36
Figure 3. Activity Diagram for Book Bank System [order book]
37
Figure 4. Activity Diagram for Book Bank System [Return book]
Sequence Diagram:
An event also is considered to be any action by an object that sends information. The event
line represents a message sent from one object to another, in which the “form” object is requesting an
operation be performed by the “to” object. The “to” object performs the operation using a method that
38
the class contains.
It is also represented by the order in which things occur and how the objects in the system
send message to one another.
39
Figure 5. Sequence Diagram For Book Issue & Return
Class Diagram:
The class diagram, also referred to as object modeling is the main static analysis diagram. The main
task of object modeling is to graphically show what each object will do in the problem domain. The
problem domain describes the structure and the relationships among objects.
40
The ATM system class diagram consists of four classes:
1. Student
2. Book
3. Issue
4. Return
5. Vendor
6. Details
1) Student:
It consists of twelve attributes and three operations. The attributes are enrollno, name, DOB,
fathername, address, dept name, batch and book limits. The operations of this class are addStInfo(),
deleteStInfo(), modifyStInfo().
2) Book:
It consists of ten attributes and four operations. This class is used to keep book information such as
author, title, vendor, price, etc
3) Issue:
It consists of eight attributes and two operations to maintain issue details such as, issue date, accno of
issued book, name of the student who borrowed book.
4) Return:
It consists of eight attributes and two operations to maintain issue details such as, issue date, accno of
issued book, name of the student who borrowed book.
5) Students:
The attributes of this class are name, dept ,year ,bcode no The operation is display students().
6) Detail:
41
The attributes of this class are book name, author, bcode no The operations are delete details().
Chart Diagram
It consists of state, events and activities. State diagrams are a familiar technique to describe the
behavior of a system. They describe all of the possible states that a particular object can get into and
how the object's state changes as a result of events that reach the object.
42
Figure 8. State Chart Diagram for BookBank System
Deployment diagrams are used to visualize the topology of the physical components of a system
where the software components are deployed.
9. Develop test cases for various white box and black box testing techniques.
43
44
45
46
47
Dept. of IT CS506PC: SE & CN LAB
1. Implement the data link layer framing methods such as character, character-stuffing
and bit stuffing
Write a C program to implement the data link layer framing methods
such as bit stuffing.
Source Code:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int a[20],b[30],i,j,k,count,n;
clrscr();
printf("enter frame length:");
scanf("%d",&n);
pritf("enter input frame(0's&1's only):");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;count=1;j=0;
while(i<n)
{
if(a[i]==1)
{
b[j]=a[i];
for(k=i+1;a[k]==1&&k<n&&count<5;k ++)
{
j++;
b[j]=a[k];
count++;
if(count==5)
{
j++;
b[j]=0;
}
i=k;
}
}
else
{
b[j]=a[i];
}
i++;
j++;
}
Output:
if(ack == windowsize)
break;
else
sent = ack;
}
return 0;
}
output:-
Output
Enter window size: 3
Enter number of frames to transmit: 5
Enter 5 frames: 12 5 89 4 6
With sliding window protocol the frames will be sent in the following manner (assuming
no corruption of frames)
After sending 3 frames at each stage sender waits for acknowledgement sent by the
receiver
12 5 89
Acknowledgement of above frames sent is received by sender
46
Acknowledgement of above frames sent is received by sender
if(ack == windowsize)
break;
else
sent = ack;
}
return 0;
}
output:-
enter window size
8
Frame 0 has been transmitted.
Frame 1 has been transmitted.
Frame 2 has been transmitted.
Frame 3 has been transmitted.
Frame 4 has been transmitted.
Frame 5 has been transmitted.
Frame 6 has been transmitted.
Frame 7 has been transmitted.
Please enter the last Acknowledgement received.
2
Frame 2 has been transmitted.
Frame 3 has been transmitted.
#include<stdio.h>
#include<conio.h>
#define INFINITY
#define MAX 10
void dijkstra(int G[MAX][MAX],int
n,int startnode);
int main()
{
int G[MAX][MAX],i,j,n,u; printf("Enter no. of vertices:");
scanf("%d",&n);
printf("\nEnter the adjacency matrix:\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&G[i][j]
);
printf("\nEnter the starting node:");
scanf("%d",&u);
dijkstra(G,n,u); return 0;
}
void dijkstra(int G[MAX][MAX],int n,int startnode)
{
int
cost[MAX][MAX],distance[MAX],pred
[MAX];
int visited[MAX],count,mindistance,nextnode,i,j;
//pred[] stores the predecessor of each node
//count gives the number of nodes seen so far
//create the cost matrix
for(i=0;i<n;i++)
for(j=0;j<n;j++) if(G[i][j]==0)
cost[i][j]=INFINITY; else
cost[i][j]=G[i][j];
//initialize pred[],distance[] and visited[]
for(i=0;i<n;i++)
{
distance[i]=cost[startnode][i];
pred[i]=startnode; visited[i]=0;
}
distance[startnode]=0;
visited[startnode]=1; count=1;
count++;
}
//print the path and distance of each node
for (i=0;i<n;i++)
if(i!=startnode)
{
printf("\nDistance of node%d=%d",i,distance[i]);
printf("\nPath=%d",i);
j=i;
do
{
j=pred[j];
printf("<-%d",j);
}while(j!=startnode);
}
}
#include<stdio.h>
struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];
int main()
{
int dmat[20][20];
int n,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&n);
printf("\nEnter the cost matrix :\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
scanf("%d",&dmat[i][j]);
dmat[i][i]=0;
rt[i].dist[j]=dmat[i][j];
rt[i].from[j]=j;
}
do
{
count=0;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
if(rt[i].dist[j]>dmat[i][k]+rt[k].dist[j])
{
rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j];
rt[i].from[j]=k;
count++;
}
}while(count!=0);
for(i=0;i<n;i++)
{
printf("\n\nState value for router %d is \n",i+1);
for(j=0;j<n;j++)
{
printf("\t\nnode %d via %d Distance%d",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n\n");
}
OUTPUT:
Enter 10 bit key: 1456987203 Sub key k1::17062538
Sub keyk2::25893401
Enter 8 bit plain text: computer Cipher text is::epfnmrct
Decrypted text is::computer