MC Lab Manual
MC Lab Manual
MC Lab Manual
Engineering Engineering
SɅRɅSWɅTI
Mission
To educate Students to become responsible & quality technocrats to fulfill
society and industry needs.
To nurture student’s creativity and skills for taking up challenges in all facets
of life.
Vision
To be among renowned institution in computer engineering education and
research by developing globally competent graduates.
Mission
To produce eminent Engineering graduates by imparting quality teaching
learning and providing hands on experience in programming to fulfill
society and industry needs.
To encourage students to pursue research and learn new technologies in
Computer Engineering and across interdisciplinary areas so that they
participate in research, innovation and entrepreneurship.
i
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
DEPARTMENT OF COMPUTER
ENGINEERING
LABORATORY MANUAL
Semester-V
ii
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
INDEX
4 Syllabus vii
iii
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
iv
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
v
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
vi
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
vii
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
management, 802.11a, 802.11b standard
4.3 Wi-Fi security : WEP ,WPA, Wireless LAN Threats ,
Securing Wireless Networks
4.4 Bluetooth: Introduction, User Scenario, Architecture,
protocol stack
Mobility Management
5.1 Mobility Management : Introduction, IP Mobility,
5. Optimization, IPv6 06
viii
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
Course Objective's
The course aims:
4. To distinguish between different protocols used in mobile computing and applications based
on it.
6. To determine or provide an opportunity for students to understand the key components and
technologies involved and to gain hands-on experiences in building mobile applications.
Course Outcomes
2. Articulate the knowledge of GSM, CDMA & Bluetooth technologies and demonstrate it.
3. Students will able to carry out simulation of frequency reuse, hidden/exposed terminal
problem
ix
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO1 2 1 2
CO2 2
CO3 2 1 2 2
CO4 2 1 2
CO5 2 1 2 2
CO6 2 1 2
COURSE
CODE: 2 1 2 2 2 2
CSL7012
1 LOWLY CORELATED
2 MODERATELY CORELATED
3 HIGHLY CORELATED
x
SɅRɅSWɅTI
Department of Computer College of
Engineering Engineering
SɅRɅSWɅTI
LIST OF EXPERIMENT'S
xi
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 1
1
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO1 2 1 2
2
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Experiment 1
AIM: Implementation of Bluetooth Network with application as transfer of a file from one
device to another.
RESOURCES REQUIRED: Android Studio, Java JDK.
THEORY:
Bluetooth is a short-range wireless technology standard that is used for exchanging data
between fixed and mobile devices over short distances using UHF radio waves in the ISM
bands, from 2.402 to 2.48 GHz, and building personal area networks (PANs). It is
mainly used as an alternative to wire connections, to exchange files between nearby portable
devices and connect cell phones and music players with wireless headphones. In the most
widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range
of up to 10 metres (33 ft).
Features of Bluetooth:
IMPLEMENTATION:
Step 1: Open Android Studio. Inside it click on Open and select the file where you have saved
the code.
3
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Step 2: Go to File select Setting and search Android SDK and download any versionof SDK as
per your requirements.
4
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Step 4: While creating a virtual machine, select a pixel as per your needs. As shown in below
snapshot I have selected Pixel 3 and went to next step. Also choose which device you want that
is in which category you want the Emulator screen.
5
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Step 5: Now you have to select a System Image and download the required packagesfor that
image. I have choosen R as a System image and have already downloaded.
6
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Step 6: In the next step the default name is given to the virtual machine. If you want to
change the name you can change and finish creating the Virtual machine setup.
Step 7: Now you can run the virtual machine. Similarly you have to create another virtual
machine so that we can transfer one file from one virtual machine to another virtual machine
via Bluetooth transfer.
7
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Step 8: Now we can transfer the files from one device to another device.
8
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CONCLUSION: Hence we have successfully implemented the Bluetooth transferusing
Android Studio.
1) Which of Q1. The following usually stores all user-related data that is also relevant to GSM
mobile systems?
Option A: VLR
Option B: HMR
Option C: CMR
Option D: SIM
Q2. Which of these is required for the transmission of digital information by translating
it into analogue signals via a particular frequency?
Option A: BSPK
Option B: QPSK
Option C: Modulation
Option D: Demodulation
Q3. Two or more antennas can also be combined to improve reception by counteracting
the negative effects of multi-path propagation. These antennas, also called
Option A: Multi-element antenna arrays
Option B: Smart antennas
Option C: Sectorized antenna
Option D: Isotropic radiator
Q4. In which one of the following, the slow and fast hopping is used?
Option A: GSM
Option B: GPRS
Option C: FHSS
Option D: None of the above
Q5. Which of the following does not come under subsystem of GSM architecture?
Option A: BSS
Option B: NSS
Option C: OSS
Option D: Channel
9
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
10
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 2
11
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO 3 2 1 2
12
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Experiment 2
THEORY:
CDMA is a channelization protocol for Multiple Access, where information can be sent
simultaneously through several transmitters over a single communication channel. It is
achieved in below steps:
A signal is generated which extends over a wide bandwidth.
The code which performs this action is called spreading code.
Later on, a specific signal can be selected with a given code even in the
presence of many other signals.
It is mainly used in mobile networks like 2G and 3G.
Procedure:
-1 if bit = 0
no signal(interpreted as 0) if station is idle
2) Each station is assigned a unique orthogonal sequence (code) which is N bit longfor
N stations.
3) Each station does a scalar multiplication of its encoded data bit and code sequence.
4) The resulting sequence is then placed on the channel.
5) Since the channel is common, amplitudes add up and hence resultant channel
sequence is sum of sequences from all channels.
6) If station 1 wants to listen to station 2, it multiplies (inner product) the channel
sequence with code of station S2.
7) The inner product is then divided by N to get data bit transmitted from station 2.
13
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
calls and theoretical limits. Operational limits and quality issues will reduce the maximum
number of calls somewhat lower than this value.
In fact, many different "signals" baseband with different spreading codes can
be modulated on the same carrier to allow many different users to be supported. Using
different orthogonal codes, interference between the signals is minimal. Conversely, when
signals are received from several mobile stations, the base station is capable of isolating
each as they have different orthogonal spreading codes.
The following figure shows the technicality of the CDMA system. During the
propagation, we mixed the signals of all users, but by that you use the same code as the
code that was used at the time of sending the receiving side. You can take out only the
signal of each user.
Advantages of CDMA:
CDMA requires a tight power control, as it suffers from near-far effect. In other words, a
user near the base station transmitting with the same power will drown the signal latter.
All signals must have more or less equal power at the receiver
Disadvantages of CDMA:
The code length must be carefully selected. A large code length can induce delay or may
cause interference.
14
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
IMPLEMENTATION:
// Java code illustrating a simple implementation of CDMA
import java.util.*;
public class CDMA
{ private int[][]
wtable;private
int[][] copy;
private int[] channel_sequence;
public void setUp(int[] data, int num_stations)
{
wtable = new
int[num_stations][num_stations];copy = new
int[num_stations][num_stations];
buildWalshTable(num_stations, 0, num_stations - 1, 0,
num_stations - 1,
false);showWalshTable(num_stations);
for (int i = 0; i < num_stations; i++)
{ for (int j = 0; j < num_stations;
j++) {
15
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
// multiply channel sequence and source station code innerProduct
+= copy[sourceStation][i] * channel_sequence[i];
}
return 0;
}
public void showWalshTable(int num_stations)
16
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
{
System.out.print("\n");
for (int i = 0; i < num_stations; i++)
{ for (int j = 0; j < num_stations;
j++) {
System.out.print(wtable[i][j] + " ");
}
System.out.print("\n");
}
System.out.println(" ------------------------- ");
System.out.print("\n");
}
// Driver Code
public static void main(String[] args)
{
int num_stations = 4;
OUTPUT:
17
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Q2. What is the interface between SGSN and HLR in a GPRS network structure?
Option A: Gs
Option B: Gn
Option C: Gb
Option D: Gr
Q4. It is defined as the process of transferring a call (or data transfer) in progress from
one channel to another channel.
Option A: Handover
18
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Option B: Handoff
Option C: Roaming
Option D: Both A and B
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
19
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 3
20
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO 3 2 1 2 2
21
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO: 03
AIM: Implementation of GSM Security Algorithm(A3/A5/A8).
THEORY:
In the World, the GSM (Global System for Mobile Communication) is the widely used cellular
standard. Due to the increase in its users the GSM network is facing several security
vulnerabilities. The GSM is made secured by using several algorithms. The algorithm used are
A3, A5, and A8 algorithms, Algorithm A3 is used for authentication, A5 is used for encryption,
and A8 is used for the generation of a cipher key.
The subscriber needs to be authenticated before he can use the services provided by the GSM.
The Authentication is based on the SIM, that stores the authentication key Ki, User
identification IMSI and the A3 Algorithm.
In the World, the GSM (Global System for Mobile Communication) is the widely used cellular
standard. Due to the increase in its users the GSM network is facing several security
vulnerabilities. The GSM is made secured by using several algorithms. The algorithm used are
A3, A5, and A8 algorithms, Algorithm A3 is used for authentication, A5 is used for encryption,
and A8 is used for the generation of a cipher key.
The subscriber needs to be authenticated before he can use the services provided by the GSM.
The Authentication is based on the SIM, that stores the authentication key Ki, User
identification IMSI and the A3 Algorithm.
IMPLEMENTATION:
import random
k=random.getrandbits(128)
m=random.getrandbits(128)
kb=bin(k)[2:]
mb=bin(m)[2:]
kbl=kb[0:64] kbr=kb[64:]
mbl=mb[0:64]
22
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
mbr=mb[64:]
a1=int(kbl,2)^int(mbr,2)
a2=int(kbr,2)^int(mbl,2)
a3=a1^a2
a4=bin(a3)[2:].zfill(64)
a5=a4[0:32]
a6=a4[32:]
a7=int(a5,2)^int(a6,2)
print("128 Bit Key = ",kb)
OUTPUT:
23
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Option D: Packet extension
Q4. In the Indirect TCP the Foreign Agent (FA) becomes or acts as a —— and relays
data in both directions
Option A: Router
Option B: Node
Option C: Proxy
Option D: Access Point
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
24
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 4
Title: Develop and application that uses GUI components (Registration Form).
25
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3 2 1 2 2
26
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO: 4
AIM: Develop and application that uses GUI components (Registration Form).
REQUIREMENT: Windows 10, Visual Studio, Java IDE.
THEORY:
Swing is a part of the JFC (Java Foundation Classes). Building Graphical User Interface in
Java requires the use of Swings. Swing Framework contains a large set of components which
allow a high level of customization and provide rich functionalities, and is used to create
window-based applications. Java swing components are lightweight, platform-independent,
provide powerful components liketables, scroll panels, buttons, list, colour chooser, etc.
we’ll see how to make a Registration form which includes all the buttons and field in one
Form.
Steps:
1) Create a Java file that contains the main class – Registration. This class will onlycontain
the main method to invoke the required methods.
class Registration {
public static void main(String[] args)
throws Exception{
MyFrame f = new MyFrame();
}}
2) Create another class MyFrame, which will contain the form.
3) In this MyFrame Class, the methods to be made are: Components like JLabel, JTextField,
JRadioButton, ButtonGroup, JComboBox, and JTextArea. These components will
collectively form the Registration form. A constructor, to initialize the components with
default values. A method actionPerformed() to get the action performed by the user and act
accordingly.
4) Copy the code of MyFrame class from below.
5) Save the file as Registration.java
6) Compile the file by using javac command.
javac Registration.java
7) Run the program by calling the main class
java Registration
27
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
IMPLEMENTATION:
import javax.swing.*;
import java.awt.*; import
java.awt.event.*;class
MyFrame
extends JFrame implements
ActionListener {
// Components of the Form
private Container c; private
JLabel title; private JLabel
name; private JTextField
tname;
28
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
private JTextArea tout;
private JLabel res;
private JTextArea resadd;
29
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
c = getContentPane();
c.setLayout(null);
title = new JLabel("REGISTRATION FORM");
title.setFont(new Font("Times New Roman", Font.BOLD |
Font.ITALIC, 26));
title.setSize(300, 20);
title.setLocation(300, 40);
c.add(title);
name = new JLabel("NAME");
name.setFont(new Font("Times New Roman", Font.BOLD, 16));
name.setSize(100, 20);
name.setLocation(100, 100);
c.add(name);
tname = new JTextField();
tname.setFont(new Font("Times New Roman", Font.PLAIN, 12));
tname.setSize(200, 30);
tname.setLocation(200, 100);
c.add(tname);
mno = new JLabel("MOBILE NO");
mno.setFont(new Font("Times New Roman", Font.BOLD, 16));
mno.setSize(100, 20);
mno.setLocation(100, 150);
c.add(mno);
tmno = new JTextField();
tmno.setFont(new Font("Times New Roman", Font.PLAIN, 12));tmno.setSize(200,
30);
tmno.setLocation(200, 150);
c.add(tmno);
30
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
gender = new JLabel("GENDER");
gender.setFont(new Font("Times New Roman", Font.BOLD, 16));
gender.setSize(100, 20);
gender.setLocation(100, 200);
c.add(gender);
male = new JRadioButton("Male");
male.setFont(new Font("Times New Roman", Font.BOLD, 12));
male.setSelected(true);
male.setSize(75, 20);
male.setLocation(200, 200);
c.add(male);
female = new JRadioButton("Female");
female.setFont(new Font("Times New Roman", Font.BOLD, 15));
female.setSelected(false);
female.setSize(80, 20);
female.setLocation(275, 200);
c.add(female);
gengp = new ButtonGroup();
gengp.add(male);
gengp.add(female);
dob = new JLabel("DATE OF BIRTH");
dob.setFont(new Font("Times New Roman", Font.BOLD, 16));dob.setSize(100,
20);
dob.setLocation(100, 250);
c.add(dob);
date = new JComboBox(dates);
date.setFont(new Font("Times New Roman", Font.PLAIN, 15));
date.setSize(50, 20);
31
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
date.setLocation(200, 250);
c.add(date);
month = new JComboBox(months);
month.setFont(new Font("Times New Roman", Font.PLAIN, 15));month.setSize(60,
20);
month.setLocation(250, 250);
c.add(month);
year = new JComboBox(years);
year.setFont(new Font("Times New Roman", Font.PLAIN, 15));year.setSize(60,
20);
year.setLocation(320, 250);
c.add(year);
add = new JLabel("ADDRESS");
add.setFont(new Font("Times New Roman", Font.BOLD, 16));
add.setSize(100, 40);
add.setLocation(100, 300);
c.add(add);
tadd = new JTextArea();
tadd.setFont(new Font("Times New Roman", Font.PLAIN, 15));
tadd.setSize(200, 75);
tadd.setLocation(200, 300);
c.add(tadd);
term = new JCheckBox("Accept Terms And Conditions.");
term.setFont(new Font("Times New Roman", Font.PLAIN, 15));
term.setSize(250, 20);
term.setLocation(150, 400);
c.add(term);
sub = new JButton("SUBMIT");
sub.setFont(new Font("Times New Roman", Font.BOLD, 15));sub.setSize(100,
30);
32
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
sub.setLocation(100, 450);
sub.addActionListener(this);
c.add(sub);
reset = new JButton("RESET");
reset.setFont(new Font("Times New Roman", Font.BOLD, 15));
reset.setSize(100, 30);
reset.setLocation(350, 450);
reset.addActionListener(this);c.add(reset);
tout = new JTextArea();
tout.setFont(new Font("Times New Roman", Font.PLAIN, 16));
tout.setSize(300, 400);
tout.setLocation(500, 100);
tout.setLineWrap(true);
tout.setEditable(false);
c.add(tout);
res = new JLabel("");
res.setFont(new Font("Times New Roman", Font.PLAIN, 20));res.setSize(500,
25);
res.setLocation(100, 500);
c.add(res);
resadd = new JTextArea();
resadd.setFont(new Font("Times New Roman", Font.PLAIN, 15));
resadd.setSize(200, 75);
resadd.setLocation(580, 175);
resadd.setLineWrap(true);
c.add(resadd); setVisible(true);
}
// method actionPerformed()
// to get the action performed
// by the user and act accordingly
public void actionPerformed(ActionEvent e)
33
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
{
if (e.getSource() == sub) {if
(term.isSelected()) {
String data1;
String data = "Name : " + tname.getText() + "\n" + "Mobile : " +
tmno.getText() + "\n";
if (male.isSelected())
data1 = "Gender : Male"+ "\n";
else
data1 = "Gender : Female"+ "\n";
String data2 = "DOB : "+ (String)date.getSelectedItem()+ "/" +
(String)month.getSelectedItem()+ "/" + (String)year.getSelectedItem()+ "\n";
String data3 = "Address : " + tadd.getText();
tout.setText(data + data1 + data2 + data3);
tout.setEditable(false);
res.setText("REGISTRATION SUCCESSFULLY .......... ");
}
else {
tout.setText("");
resadd.setText("");
res.setText("Please accept the" + " terms & conditions..");
}
}
else if (e.getSource() == reset) {
String def = "";
tname.setText(def);
tadd.setText(def);
tmno.setText(def);
res.setText(def);
tout.setText(def);
34
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
term.setSelected(false);
date.setSelectedIndex(0);
month.setSelectedIndex(0);
year.setSelectedIndex(0);
resadd.setText(def);
}
}
}
// Driver Code class
Registration {
public static void main(String[] args) throws Exception
{
MyFrame f = new MyFrame();
}
}
35
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Q4. What is Spring MVC?
Ans – The MVC stands for Model-View-Controller, which is its core function, allowing separation of the
business logic, presentation logic, and navigation logic.
Ans – The Java Persistence API (JPA) is the standard way of persisting Java objects into relational
databases.
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
36
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 5
37
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3 2 1 2 2
38
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 5
AIM: To implement a Paint Application in Java.
THEORY:
AWT:
AWT stands for Abstract window toolkit is an Application programming interface (API) for
creating Graphical User Interface (GUI) in Java. It allows Java programmers to develop
window-based applications.
AWT provides various components like button, label, checkbox, etc. used as objects inside a
Java Program. AWT components use the resources of the operating system, i.e., they are
platform-dependent, which means, component's view can be changed according to the view of
the operating system. The classes for AWT are provided by the Java.awt package for various
AWT components. The following image represents the hierarchy for Java AWT.
39
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Component Class:
The component class stands at the top of the AWT hierarchy, is an abstract class thatcontains all
the properties of the component visible on the screen. The Component object contains
information about the currently selected foreground and background colour. It also has
information about the currently selected text colour.
Container:
The container is a component that contains other components like button, text field, label, etc.
However, it is a subclass of the Component class.
Panel:
The panel can be defined as a container that can be used to hold other components. However, it
doesn't contain the title bar, menu bar, or border.
Window:
A window can be defined as a container that doesn't contain any border or menu bar.It creates a
top-level view. However, we must have a frame, dialog, or another window for creating a
window.
Frame:
The frame is a subclass of Window. It can be defined as a container with components like
button, text field, label, etc. In other words, AWT applications are mostly created using frame
container.
Dialog:
The Dialog control represents a top level window with a border and a title used to take some
form of input from the user. It inherits the Window class. Unlike Frame, it doesn't have
maximize and minimize buttons.
IMPLEMENTATION:
TestDraw.java
public class TestDraw
{
public static void main( String args[] )
{
40
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
DrawFrame paintGui = new DrawFrame(); //initalize DrawFrame object calledpaintGui
} // end main
} // end class TestDraw
DrawFrame.java
OUTPUT:
41
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
A. system
B. component
C. container
D. component manager
A. java.all.Component
B. all.awt.Component
C. java.awt.Component
D. awt.Component
42
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
A. 2
B. 3
C. 4
D. 5
A. border layout
B. grid layout
C. panel
D. layout manager
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
43
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 6
44
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3 2 1 2 2
45
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 6
THEORY:
Working of GPS:
Any instant of time, there are at least 4 GPS satellites in line of sight to a receiver on the earth.
Each of these GPS satellites sends information about its position and the current time to the
GPS receiver at fixed regular instants of time. This information is transmitted to the receiver in
the form of signal which is then intercepted by the receiver devices. These signals are radio
signals that travel with the speed of light. The distance between a GPS receiver and the satellite
is calculated by finding the difference between the time the signal was sent from GPS satellite
and the time the GPS receiver received the signal.
Once the receiver receives the signal from at least three satellites, the receiver then points its
location using trilateration process. A GPS requires at least 3 satellites to calculate 2-D
position(latitude and longitude on a map). In this case, the GPS receiver assumes that it is
located at mean sea level. However, it requires at least 4 satellites to find receivers 3-D
position(latitude, longitude, and altitude).
46
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Trilateration:
Trilateration is the process of determining your position based on the intersection of spheres.
When a receiver receives a signal from one of the satellite, it calculates its distance from the
satellite considering a 3-D sphere with the satellite located at the center of the sphere. Once
the receiver does the same with 3 other GPS satellites, the receiver then proceeds to find the
intersection point of the 3 spheres to calculate it’s location. Once the position of a receiver is
calculated, the GPS device can then easilycalculate:
Time of sunrise and sunset
Speed
Track
distance to destination of the GPS receiver.
IMPLEMENTATION:
package com.yayandroid.locationmanager.sample;import
android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.yayandroid.locationmanager.sample.activity.SampleActivity;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
47
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
}
public void inActivityClick(View view) {
startActivity(new Intent(this, SampleActivity.class));
}
OUTPUT:
The location for Sample in Activity, Sample in Fragment and Sample in Service is same and
the location address is being captured in phone for getting the actual location address.
48
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
49
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
A. 1970
B. 1971
C. 1972
D. 1973
Q2. ___________ is present on the satellites of GPS to contribute the accurate time information.
A. Antenna
B. Transponder
50
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
C. Atomic clock
Q3. How many minimum satellites are operational in the constellation of GPS?
A. 24
B. 25
C. 26
D. 27
A. Compass
B. GLONASS
C. Galileo
D. NavIC
Q5. Once the Selective Availability got lifted the accuracy of GPS was for __________ meters.
A. 3
B. 4
C. 5
D. 6
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
51
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 7
52
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3,CO4,CO5 2 1 2 2 2
53
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO: 07
AIM: To implement a basic function of Android Notification.
THEORY:
Android Notification:
A notification is a message you can display to the user outside of your application's normal UI.
When you tell the system to issue a notification, it first appears as an icon in the notification
area. To see the details of the notification, the user opens the notification drawer. Both the
notification area and the notification drawer are system- controlled areas that the user can view
at any time.
Android Notification provides short, timely information about the action happened in the
application, even it is not running. The notification displays the icon, title and some amount of
the content text.
The properties are set using NotificationCompat.Builder object. Some of the notification
properties are mention below:
IMPLEMENTATION:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fernando.basicnotification">
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
54
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
android:supportsRtl="true"
android:theme="@style/Theme.BasicNotification">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application></manifest>
OUTPUT:
55
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
a. OSS
b. Sourceforge
56
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
c. Apache/MIT
d. None of the above
Q2. Which of the following virtual machine is used by the Android operating system?
a. JVM
b. Dalvik virtual machine
c. Simple virtual machine
d. None of the above
Q4. On which of the following, developers can test the application, during developing the android
applications?
a. Third-party emulators
b. Emulator included in Android SDK
c. Physical android phone
d. All of the above
a. onClick() method
b. onCreate() method
c. onStart() method
d. onBackPressed() method
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
57
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 8
58
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3,CO4,CO5 2 1 2 2 2
59
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO: 08
THEORY:
What is Database?
The database is a collection of inter-related data which is used to retrieve, insert and delete the
data efficiently. It is also used to organize the data in the form of a table, schema, views, and
reports, etc. Using the database, you can easily retrieve, insert, and delete the information.
For example: The college Database organizes the data about the admin, staff, students and
faculty etc.
Database management system is a software which is used to manage the database. For
example: MySQL, Oracle, etc are a very popular commercial database which is used
in different applications.
DBMS provides an interface to perform various operations like database creation,
storing data in it, updating data, creating a table in the database and a lot more.
It provides protection and security to the database. In the case of multiple users, it also
maintains data consistency.
Data Definition: It is used for creation, modification, and removal of definition that defines
the organization of data in the database.
Data Updation: It is used for the insertion, modification, and deletion of the actual data in the
database.
Data Retrieval: It is used to retrieve the data from the database which can be used by
applications for various purposes.
User Administration: It is used for registering and monitoring users, maintain data integrity,
enforcing data security, dealing with concurrency control, monitoring performance and
recovering information corrupted by unexpected failure.
60
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Characteristics of DBMS:
It contains ACID properties which maintain data in a healthy state in case offailure.
It can reduce the complex relationship between data.
It is used to support manipulation and processing of data.
It is used to provide security of data.
It can view the database from different viewpoints according to therequirements
of the user.
Advantages of DBMS:
Controls database redundancy: It can control data redundancy because it stores allthe data in
one single database file and that recorded data is placed in the database.
Data sharing: In DBMS, the authorized users of an organization can share the dataamong
multiple users.
Easily Maintenance: It can be easily maintainable due to the centralized nature of thedatabase
system.
Reduce time: It reduces development time and maintenance need.
Backup: It provides backup and recovery subsystems which create automatic backupof data
from hardware and software failures and restores the data if required.
Multiple user interface: It provides different types of user interfaces like graphicaluser
interfaces, application program interfaces
IMPLEMENTATION:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.inventory">
61
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
<application
android:name="com.example.inventory.InventoryApplication"
android:allowBackup="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.InventoryApp">
<activity android:name="com.example.inventory.MainActivity">
<intent-filter>
</intent-filter>
</activity>
</application>
</manifest>
62
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
OUTPUT:
63
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
64
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
65
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 9
66
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3,CO4 2 1 2 2
67
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO: 09
68
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
<activity android:name=".FinalIncomeActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
></activity>
<activity android:name=".NextIncome" />
<activity android:name=".MainActivity">
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".IncomeActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
</application>
</manifest>
69
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
OUTPUT:
70
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
71
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
C - status >= 400
D - None of the above
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
72
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
EXPERIMENT NO- 10
73
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO3,CO4,CO5 2 2 2 2 2
74
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Experiment 10
RESOURCES REQUIRED:
THEORY:
A wireless network with lack of centralized control entity, sharing of wireless bandwidth among
network access nodes i.e. medium access control (MAC) nodes must be organized in
decentralized manner. The hidden terminal problem occurs when a terminal is visible from a
wireless access point (APs), but not from other nodes communicating with that AP. This
situation leads the difficulties in medium access control sublayer over wireless networking.
In a formal way hidden terminal are nodes in a wireless network that are out of range of other
node or a collection of nodes. Consider a wireless networking, each node at the far edge of the
access point’s range, which is known as A, can see the access point, but it is unlikely that the
same node can see a node on the opposite end of the access point’s range, C. These nodes are
known as hidden. The problem is when nodes A and C start to send packets simultaneously to
the access point B. Because the nodes A and C are out of range of each other and so cannot
detect a collision while transmitting, Carrier sense multiple access with collision detection
(CSMA/CD) does not work, and collisions occur, which then corrupt the data received by the
access point. To overcome the hidden node problem, RTS/CTS handshaking (IEEE 802.11
RTS/CTS) is implemented in conjunction with the Carrier sense multiple accesses withcollision
avoidance (CSMA/CA) scheme. The same problem exists in a MANET.
The transmission range of access point A reaches at B, but not at access point C, similarly
transmission range of access point C reaches B, but not at A. These nodes are known as hidden
terminals. The problem occurs when nodes A and C start to send data packets simultaneously to
the access point B. Because the access points A and C are out of range of each other and
resultant they cannot detect a collision while transmitting, Carrier sense multiple access with
collision detection (CSMA/CD) does not work, and collisions occur, which then corrupt the
data received by the access point B due to the hidden terminal problem.
The hidden terminal analogy is described as follows:
75
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
IMPLEMENTATION:
https://github.com/vinaynpp/mcc BEGIN{
sim_end = 200; i=0;
while (i<=sim_end) {sec[i]=0; i+=1;};
}
{
if ($1=="r" && $7=="cbr"&& $3=="_0_") { sec[int($2)]+=$8;
};
}
END{
i=0;
while (i<=sim_end) {print i " " sec[i]; i+=1;};
}# Define options
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
SɅRɅSWɅTI 76
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON Phy/WirelessPhy set CSThresh
for {set i 0} {$i < $val(nn) } { incr i } { set node_($i) [$ns node]
}
$node_(0) set X_ $val(R)
$node_(0) set Y_ $val(R)
$node_(0) set Z_ 0
$node_(1) set X_ $val(R)
$node_(1) set Y_ 0
$node_(1) set Z_ 0
$node_(2) set X_ 0
$node_(2) set Y_ $val(R)
$node_(2) set Z_ 0
$node_(3) set X_ [expr $val(R) *2]
$node_(3) set Y_ $val(R)
$node_(3) set Z_ 0
$node_(4) set X_ $val(R)
$node_(4) set Y_ [expr $val(R) *2]
$node_(4) set Z_ 0
for {set i 0} {$i<$val(nn)} {incr i} {
$ns initial_node_pos $node_($i) 30
SɅRɅSWɅTI 77
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
}
# Generation of movements
$ns at 0 "$node_(1) setdest $val(R) $val(R) 3.0"
$ns at 0 "$node_(2) setdest $val(R) $val(R) 3.0"
$ns at 0 "$node_(3) setdest $val(R) $val(R) 3.0"
$ns at 0 "$node_(4) setdest $val(R) $val(R) 3.0"
# Set a TCP connection between node_(0) and node_(1) set tcp [new
Agent/TCP/Newreno]
#$tcp set class_ 2
set tcp [new Agent/UDP]
$tcp set class_ 2
set sink [new Agent/Null]
$ns attach-agent $node_(1) $tcp
$ns attach-agent $node_(0) $sink
$ns connect $tcp $sink
set ftp [new Application/Traffic/CBR]
$ftp attach-agent $tcp
$ns at 0.0 "$ftp start"
# ################################################
# For coloring but doesnot work
# ################################################
$tcp set fid_ 1
$ns color 1 blue #///////////////////////////////////////////////// set tcp [new Agent/UDP]
$tcp set class_ 2
set sink [new Agent/Null]
$ns attach-agent $node_(2) $tcp
$ns attach-agent $node_(0) $sink
$ns connect $tcp $sink
set ftp [new Application/Traffic/CBR]
$ftp attach-agent $tcp
$ns at 0.0 "$ftp start"
set tcp [new Agent/UDP]
SɅRɅSWɅTI 78
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
$tcp set class_ 2
set sink [new Agent/Null]
$ns attach-agent $node_(3) $tcp
$ns attach-agent $node_(0) $sink
$ns connect $tcp $sink
set ftp [new Application/Traffic/CBR]
$ftp attach-agent $tcp
$ns at 0.0 "$ftp start"
set tcp [new Agent/UDP]
$tcp set class_ 2
set sink [new Agent/Null]
$ns attach-agent $node_(4) $tcp
$ns attach-agent $node_(0) $sink
$ns connect $tcp $sink
set ftp [new Application/Traffic/CBR]
$ftp attach-agent $tcp
$ns at 0.0 "$ftp start"
# Telling nodes when the simulation ends #for {set i 0} {$i < $val(nn) } { incr i } { #
$ns at $val(stop) "$node_($i) reset"; #}
OUTPUT:
SɅRɅSWɅTI 79
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
SɅRɅSWɅTI 80
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
SɅRɅSWɅTI 81
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
CONCLUSION: Thus, we have performed the experiment of and illustrated the hidden
terminal problem using NS2 and properly explained the same which helps to understand
better.
82 8 2
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Q1. A___________ sensing system is inherently more robust against individual sensor node
or link failures, because of redundancy in the network
A. centralized
B. decentralized
C. ad-hoc
D. multi hope
Q3. Wireless networks are computer networks that use radio frequency channels as their __ for
communication.
A. physical medium
B. medium access control
C. tdma
D. cdma
A. collision avoidance
B. overhearing avoidance
C. both
D. one of above
Q5. This version is time scheduled. A central controller in the network assigns a fixed
transmission order
83 8 3
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
A. 1-persistent csma
B. non-persistent csma
C. p-persistent csma
D. o-persistent csma
REFERENCES :
1. https://nptel.ac.in/courses/106/106/106106147/
2. https://www.coursera.org/learn/smart-device-mobile-emerging-technologies
84 8 4
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
85 8 5
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
Telephony Manager
Example
Main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="Telephony Manager Demo"android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"android:id="@+id/text1"
android:text="Result"></TextView>
</LinearLayout>
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manish.telephony"
android:versionCode="1"
android:versionName="1.0" >
86 8 6
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
<uses-sdk android:minSdkVersion="15" />
<activity
android:label="@string/app_name"
android:name=".TelephonyManagerDemoActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.widget.TextView;
getSystemService(Context.TELEPHONY_SERVICE);
87 8 7
SɅRɅSWɅTI
Department of College of
Computer Engineering Engineering
SɅRɅSWɅTI
// Create a new PhoneStateListener listener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
String stateString = "N/A";
switch (state) {
case
TelephonyManager.CALL_STATE_ID
LE:stateString = "Idle";
break;
case
TelephonyManager.CALL_STATE_OFFH
OOK:stateString = "Off Hook";
break;
case
TelephonyManager.CALL_STATE_RINGI
NG:stateString = "Ringing";
break;
}
textView.append(String.format("\nCallState: %s", stateString));
}
};
// Register the listener wit the telephony manager
telephonyManager.listen(listener,
PhoneStateListener.LISTEN_CALL_STATE);
}
}
Output:
88 8 8
SɅRɅSWɅTI