Thursday, 3 September 2015

1.
(a) What is meant by the term Web Service? Explain with the help of an example. List
various protocols that are used for creating a web service. Also explain the process of
creating a web service. (6 Marks)
ANs:
Web services are a way to communicate between different computers over the World Wide
Web. You already know that the Remote Procedure Call (RPC) allow distributed component
to communicate. Two RPC technologies, Distributed Component Object Model (DCOM) and
Common Object Request Broker Architecture (CORBA) are widely used. But, both the
technologies are too complex to provide interoperability among the computers.
DCOM is supported by Microsoft and uses the Object Remote Procedure Call
(ORPC) to interface components whereas CORBA is designed to be cross-platform
and it requires manual intervention. So, both the technologies are not fulfilling the goal of

universal interoperability.
HTTP
Protocol stands for Hyper Text Transfer Protocol. It is the protocol used to convey
information of World Wide Web (WWW). HTTP protocol is a stateless and connectionless
protocol. HTTP is called as a stateless protocol because each command request is executed
independently and it does not remember anything about previous execution. It is based on a
request/request paradigm. In this protocol the communication generally takes place over a
TCP/IP protocol.

SOAP
SOAP is an XML-based protocol for exchanging information between computers.

  • SOAP is a communication protocol.
  • SOAP is for communication between applications.
  • SOAP is a format for sending messages.
  • SOAP is designed to communicate via Internet.
  • SOAP is platform independent. 
  • SOAP is language independent.
  • SOAP is simple and extensible.
  • SOAP allows you to get around firewalls.
  • SOAP will be developed as a W3C standard. 

WSDL
WSDL is an XML-based language for describing web services and how to access them.
  • WSDL stands for Web Services Description Language.
  • WSDL was developed jointly by Microsoft and IBM.
  • WSDL is an XML based protocol for information exchange in decentralized and distributed environments.
  • WSDL is the standard format for describing a web service.
  • WSDL definition describes how to access a web service and what operations it will perform.
  • WSDL is a language for describing how to interface with XML-based services.
  • WSDL is an integral part of UDDI, an XML-based worldwide business registry.
  • WSDL is the language that UDDI uses.
  • WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'. 
UDDI
  • UDDI is an XML-based standard for describing, publishing, and finding web services.
  • UDDI stands for Universal Description, Discovery, and Integration.
  • UDDI is a specification for a distributed registry of web services.
  • UDDI is platform independent, open framework.
  • UDDI can communicate via SOAP, CORBA, and Java RMI Protocol.
  • UDDI uses WSDL to describe interfaces to web services.
  • UDDI is seen with SOAP and WSDL as one of the three foundation standards of web services.
  • UDDI is an open industry initiative enabling businesses to discover each other and definev how they interact over the Internet. 
Steps to create our simple Web Service:
  • Create the Web Service business logic. First we need to write a Java class that implements the Web Service business logic. In this case, our business logic will be a simple Java class that simulates a stock quote service.
  • Deploy the Java class to the SOAP server. Next we need to turn the Java class into a Web Service. We'll show how to deploy the Java class to a SOAP server using the WASP deployment tool.
  • Generate client access classes. A client application uses a proxy object to access a Web Service. At request time, the proxy accepts a Java method call from the application and translates it into an XML message. At response time, the proxy receives the SOAP reply message, translates it into Java objects, and returns the results to the client application.
  • Client application development. The client application treats the proxy as a standard Java object that facilitates the communication with a Web Service. 


(b) Create a simple form that may be used for appearing in the entrance test of a
University. The form should include details like name, mother/father name,
qualifications with degree name, year of passing the degree, percentage,
University/Board name; address (permanent and postal both), contact phone, email
Id, the programme in which admission is desired and related information. The form
should have relevant drop down lists such as List of Universities or Boards, list of
programmes etc. You must use CSS. Explain the advantages of using CSS.
(6 Marks)
Ans: 
<html>
<head>
<title>Online Admission</title>
<link rel="stylesheet" type="text/css" href="css2.css">
</head>
<body>
<form name="f1">
<table>
<tr>
<td colspan="2"><h1><u>Admission of Entrance</u></h1></td>
</tr>
<tr>
<td>Name </td>
 <td><input type="text"></td>
</tr>
<tr>
<td>Father's Name </td>
 <td><input type="text"></td>
</tr>
<tr>
<td>Mother'S Name </td>
 <td><input type="text"></td>
</tr> 
<tr>
<td>Qualification</td>
<td><input type="text" name="Min. Qualification" value=""></td>
</tr>
<tr>
<td>Pass out year </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Marks(%)</td>
<td><input type="text"></td>
</tr>
<tr>
<td>Programme</td>
<td>
<select name="tt">
<option>BCA</option>
<option>MCA</option>
<option>B.Tech</option>
<option>BSc</option>
</td>
</tr>
<tr>
<td>University/Board</td>
<td>
<select name="t">
<option>IGNOU</option>
<option>Jamia</option>
<option>JNU</option>
<option>DU</option>
</td>
</tr>
<tr>
<td>Address </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Contact No. </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Email Id</td>
<td> <input type="text"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit"></td>
</tr>
</table>
</body>
</form>
</html>

CSS:-
table{
 padding: 1% 200;
 background:top repeat-x #FAFAFF ;
 font-size:25pt;
 color:#FF0066;
 font-weight:bold;
 font-align:left;
}
input[type="text"], input[type="email"], textarea, select,button[type="submit"] { 
color: #555;
 height: 30px;
 line-height:15px;
 width: 100%;
 padding: 0px 0px 0px 10px;
 margin-top: 2px;
 border: 1px solid #E5E5E5;
 background: #FBFBFB;
 outline: 0;
 } 

(c) Create a simple HTML based web page showing services offered in a Bank. The web page
should consist of three sections. All these three sections should be in separate divisions (using
<div> tags). The first section should show list of services offered by Bank, second section should
show the site plan and the third section should be a login area for the customers. Also create two
CSS files for this page that demonstrates how CSS can change the display format without affecting
the content. (6 Marks)
Ans:
Css1.css
.header{
 padding: 2% 200;
 background:top repeat-x #006F00;
 border-bottom: solid 1px #001C32;
 font-size:30pt;
 color:#FF0066;
 font-weight:bold;
}
.banner{
 position:relative;
 left:250px;
 font-size:20pt;
 color:#00FF66;
}
h1 {
 color: maroon;
 margin-left: 40px;
}
.div1
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:0; 
background-color:#FF7791;
display: block;
float: left;
}
.div2
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:3pt;
background-color:#11FF91;
display: block;
float: left;
}
.div3
{
padding: 5 5 5 5;
width:37.5%;
position:relative;
left:3pt;
background-color:#FF3391;
display: block;
float: right;

CSS2.css:-
.header{
 padding: 1% 200;
 background:top repeat-x #FF0066;
 border-bottom: solid 1px #001C32;
 font-size:25pt;
 color:#FFFFFF;
 font-weight:bold;
}
.banner{
 position:relative;
 left:250px;
 font-size:18pt;
 color:#00FFFF;
}
.div1
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:0;
background-color:#FFFF91;
display: block; 
float: left;
}
.div2
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:3pt;
background-color:#FFFF91;
display: block;
float: left;
}
.div3
{
padding: 5 5 5 5;
width:37.5%;
position:relative;
left:3pt;
background-color:#FFFF91;
display: block;
float: right;
}

INDEX.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<div class="header">ABC BANK<span class="banner"> A Bank for All..............</span></div>
<br>
<div class="div1"><h1>Put here services offered by Bank<br>...............<br>...............<br></div>
<div class="div2">show the site plan.............. </div>
<div class="div3">
<form name="f1">
User ID :<input type="text"><br><br>
Password :<input type="text"><br>
<input type="submit" value="Login">
<input type="submit" value="Cancel">
</form>
</div>
</body>
</html>



(d) Explain the document structure of an XML document. A University programme contains
information like programme code, programme name, duration, credits etc. A programme consists
of a number of semesters. Every semester a number of courses are offered. Some of these courses
are compulsory and some optional. Create an XML documents containing information of five such
programmes. Also create the DTD for the XML document you have created.(8 Marks)
Ans: 
An XML document has three parts:
A. The XML processing Instruction(s), also called the XML declaration;
B. The Document Type Declaration;
C. The document instance.

A. XML Declaration The XML processing instruction declares the document to be an
XML document for an application or parser this declaration is important. It may also
include: the version of XML, encoding type; whether the document is stand-alone;
The encoding attribute is used to inform the XML processor of the type of character
encoding in the document. For example: - UTF-8 and UTF-16 and ISO-10646-UCS-
2 are common encoding type.
<?xml version = “1.0” encoding = “UTF-8” ?> 

B. Document Type Declaration (DTD)
A DTD is used to define the syntax and grammar of a document, that is, it defines the
meaning of the document elements. A Document Type Definition (DTD) sets all the
rules for the document regarding elements, attributes, and other components. This
DTD may be either an external DTD or Internal DTD.
  • Internal DTD - An internal DTD document is contained completely within the XML document.
  • External DTD - An external DTD document is a seperate document, referenced from within the XML document 
C. Document Instance:-The instance contains the remaining parts of the XML
document, including the actual contents of the document, such as characters,
paragraphs, pages and graphics.
Elements are the most important part of an XML document. An element consists of
content enclosed in an opening tag and a closing tag. An element can contain
several different types of content: root element, child element and attributes. 

DTD
<!DOCTYPE university [
<!ELEMENT university ( (pcode | pname | duration | credit)+)>
<!ELEMENT pname(semester, courses)>
<!ELEMENT pcode( #PCDATA )>
<!ELEMENT semester( #PCDATA )>
<!ELEMENT course( #PCDATA )>
<!ELEMENT duration ( #PCDATA )>
<!ELEMENT credit ( #PCDATA )>
<!ELEMENT salary( #PCDATA )>
]>
Documents
<university> 
<pcode>C001</pcode>
<pname>BCA<pname>
 <semester>2</semester>
 <course>c-language,CO,math</course>
</pname>
<duration>3 years</duration>
<credit>45</credit>
</university>
[Note: input four record similarly.] 



(e) List at least 5 commands of JavaScript and explain them. Write a program using JavaScript that
changes the text colour and background colour of a division after every 5 seconds. (8 Marks)
Ans: 
5 Commands in JavaScript
  • break Terminates a switch or a loop
  • continue Jumps out of a loop and starts at the top
  • if ... else Marks a block of statements to be executed, depending on a condition
  • switch Marks a block of statements to be executed, depending on different cases
  • var Declares a variable
<!DOCTYPE html>
<html>
<head>
<style>
#mydiv1 {
 width: 200px;
 height: 300px;
 background-color:cyan;
 color: #000000;
 text-align:center;
}
</style>
</head>
<body onload="mypix()">
<script>
var col =new Array("red","green","blue");
var a=0
function mypix()
{
 document.getElementById("mydiv1").style.backgroundColor =col[a];
a=a+1;
if(a>=3)
a=0;
setTimeout("mypix()", 5000);
mypix()
</script>
<div id="mydiv1">
 <h1>Classes for BCA</h1>
</div>
</body>
</html>



 (f) Explain the input options used in WML with the help of an example each. Create a simple
WML program that should display an image and a table.(6 Marks)
Ans:
Input example:-
<p>PIXELES Classes<br/>
“tudeŶt’s Naŵe: <iŶput Ŷaŵe="Ŷaŵe" size="ϮϬ"/>
 Enrol : <input name="enrol" size="20" />
 Course: <input name="cc" size="20"/>
</p>
</card>
</wml> 
Example Image and table 
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
 <card id="page1" title="Table and image in WML">
 <p>
 <table columns="3">
 <tr>
 <td>Cell A</td>
 <td>Cell B</td>
 <td>Cell C</td>
 </tr>
 <tr>
 <td><img src="path" alt="myImage"/></td>
 <td><img src="path" alt="myImage"/></td>>
 <td><img src="path" alt="myImage"/></td>
 </tr>
 </table>
 </p>
 </card>
</wml>


2. 
(a) Explain the MVC Architecture with the help of a diagram. Also explain HTTP methods and their
use. (10 Marks)
Ans: 
This architecture is known as Model-View-Controller (MVC). This architecture can also be used for
the development of a web application.
Model: In the context of MVC a Model defines the data model and its access controls. The main role
of this component is to represent data and perform updates on it as per the defined rules. The main
responsibility of this component is to accept user requests and the data entered by the user and
perform the necessary data related function.
View: The function of the view will be to accept the data from the Model and convert it to form that
can be seen be a user in a user friendly way. Thus, view is responsible for displaying web pages for
the user.
Controller: A user may be allowed to interact with the web pages created by the Viewer component.
This interaction may be in the form of selection of options of Menu, pull down lists, check boxes etc., 

HTTP METHODS
  • GET Method: The Get method is used to getting the data from the server.
  • POST Method: The post method is used for sending data to the server.
  • HEAD Method: When a user wants to know about the headers, like MIME types, charset, Content- Length then we use Head method.
  • TRACE Method: Trace the request message that is being received on the other side.
  • DELETE Method: It is used for delete the resources, files at the requested URL
  • OPTIONS Method: It lists the Http methods to which the thing at the requested URL can respond.
  • PUT Method: It put the enclosed information at the requested URL.
  • CONNECT Method: It connects for the purpose of tunnelling. 



(b) Explain the uses of JSP elements with the help of examples. Also explain any five JSP implicit
objects.
(10 Marks)
ANs:
Elements of JSP:-
Directives 
Directives are used as guiding the JSP container for translating and compilation of JSP page. It
appears at the top of the page.
Directives have the following syntax: 
<%@ directive attribute="value"%>
You can write XML equivalent of the above syntax as follows:
<jsp:directive. directivename attribute="value" />

page Directive
The page Directive is used to specify the attributes of JSP page such as declaration of other resources
i.e. classes and packages,
<%@ page attribute = "value͟" %>
 <%@ page import=͟"java.io.*, java.util.Date" buffer="16k" autoFlush="false" % >
include Directive
Include directive is an important JSP directive. This is used to insert text and code in the form of file
such as html, JSP into a current JSP document at the translation time.

<%@ include file = "relative URL͟" %>
JSP Implicit Object
JSP supports implicit objects which are listed below:-
Request Object
The request object is an instance of HttpServletRequest interface. This object is used to retrieves the
values that the client browser passed to the server during HTTP request such as cookies, headers or
parameters associated with the request.
For example: 
<html><body><h2>Example of request Object</h2>
<% // Get the Programme Name from the request Query
 String name=request.getQueryString();
 out.println("Hello: "+name); %>
</body></html> 

response Object
As you know, response is a process to responding against it request. Using response object, reply is
sent back to the client browser.
<% response.sendRedirect("http://www.ignou.org");%>

session Object
The session object is represented by the javax.servlet.http.HttpSession interface. This object is
behaves in same way as under the java servlet. For each user, servlet can create an HttpSession
object that is associated with a particular single user.
application Object
The application object is an instance of javax.servlet.ServletContext. This object has application
scope which means that it is available to all JSP pages until the JSP engine shut down. The
ServletContext is the environment where the servlet run.
page Object
It represents the javax.servlet.jsp.HttpJspPage interface. This object is reference to the current
instance of the JSP page. The page object is a synonym for this object and is not useful for
programming language.

(c) Differentiate between cookies and sessions with the help of an example. Create a simple HTML
login page and write suitable JSP program that checks the user ID and password entered by the
user in the HTML page, with a defined value (you need not use database for this problem). If the
username and ID is incorrect user is returned to HTML login page, else u is shown a message
"Welcome to JSP world". 
Ans
Cookies – Cookies are small piece of information that is sent by web server in response header and
gets stored in the browser cookies. When client make further request, it adds the cookie to the
request header and we can utilize it to keep track of the session. We can maintain a session with
cookies but if the client disables the cookies,then it won't work.
Session is a conversional state between client and server and it can consists of multiple request
and response between client and server. Since HTTP and Web Server both are stateless, the only
way to maintain a session is when some unique information about the session (session id) is passed
between server and client in every request and response.

Login.html
< html> <head>
<title>JSP Page</title>
 </head>
<body>
<h1>Login Page</h1>
<center> <h2>Signup Details</h2>
<form action="LoginCheck.jsp" method="post"> <br/>
Username:<input type="text" name="username"> <br/>
Password:<input type="password" name="password"> <br/>
<input type="submit" value="Submit">
</form>
 </center>
</body>
< /html>

Logincheck.jsp 
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
 if((username.equals("anurag") && password.equals("jain")))
{
session.setAttribute("username",username);
 response.sendRedirect("Home.jsp"); }
else
response.sendRedirect("Error.jsp");
%>
 </body>

< /html>

home.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>JSP Page</title>
</head>
 <body>
<br/><br/><br/><br/><br/> <center> <h2>
<%
String a=session.getAttribute("username").toString();
 out.println("Welcome to JSP World"+a);
%>
</center> </body>< /html>



(d) Explain different types of JDBC drivers. Create a database of username and passwords. Use the
same HTML login form as you created for part (c) above, but check the values from the database
using JSP. Explain all the steps that you have performed. Make suitable assumptions, if any.
Ans:
Type 1 JDBC Driver 
A type 1 JDBC driver consists of a Java part that translates the JDBC interface calls to
ODBC calls. An ODBC bridge then calls the ODBC driver of the given database. Type 1
drivers are (were) mostly intended to be used in the beginning, when there were no type 4

drivers (all Java drivers).

Type 2 JDBC Driver
A type 2 JDBC driver is like a type 1 driver, except the ODBC part is replaced with a native
code part instead. The native code part is targeted at a specific database product. Here is an
illustration of a type 2 JDBC driver:

Type 3 JDBC Driver
A type 3 JDBC driver is an all Java driver that sends the JDBC interface calls to an
intermediate server. The intermediate server then connects to the database on behalf of the
JDBC driver.

Type 4 JDBC Driver
A type 4 JDBC driver is an all Java driver which connects directly to the database. It is
implemented for a specific database product. Today, most JDBC drivers are type 4 drivers.

<%@page import ="java.io.*"%>
 <%@page import ="javax.servlet.*"%>
 <%@page import ="javax.servlet.http.*"%>
 <%@page import ="java.sql.*"%>
<%
String uid = request.getParameter("username");
String pass = request.getParameter("password");
try {
 // Step 1. Load the JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 // Step 2. Create a Connection object
Connection con=DriverManager.getConnection("jdbc:odbc:pixdata");
System.out.println("got connection");
 // Step 3. Create a Statement object and call its executeUpdate
 // method to insert a record
 Statement s = con.createStatement();
"select * from Login where userID='"+loginid+"'";
 // Step 4. Use the same Statement object to obtain a ResultSet object
 sql = "SELECT userid, pass FROM Users where username=" ‘+uid+’;
 ResultSet rs = s.executeQuery(sql);
 while (rs.next())
{
u=rs.getString(1);
p= rs.getString(2);
 }
if(uid.equals(u) && pass .equals(p))
{
out.println("Login successful");
 }
else
{
out.println("incorrect username/password͟Í¿;
 rs.close();
 s.close();
 con.close();
}
catch (ClassNotFoundException e1)
 {
 // JDBC driver class not found, print error message to the console
 System.out.println(e1.toString());
}
%>
</body>
</html> 
1. (a) Why would an application use UDP instead of TCP? Discuss. (6 Marks) 
Ans: UDP provides an unreliable service and datagram may arrive out of order, appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level. Time-sensitive applications often use UDP because dropping packets is preferable to wait for delayed packets, which may not be an option in a real-time system. The User Datagram Protocol (UDP) is a transport layer protocol for use with the IP network layer protocol. It provides a best-effort datagram service to an end system (IP host). UDP provides no guarantee for delivery and no protection from duplication, but the simplicity of UDP reduces overhead from the protocol and can be adequate for some applications. A computer may send UDP packets without first establishing a connection to a recipient. The computer completes the appropriate fields in the UDP header (PCI) and forwards the data together with the header for transmission by the IP network layer. Typically, use UDP in applications where speed is more critical than reliability. For example, it may be better to use UDP in an application sending data from a fast acquisition where it is acceptable to lose some data points. You can also use UDP to broadcast to any machine(s) listening to the server.

(b) What is the purpose of VPNs and what are the main features they provide? (4 Marks)
Ans: 
Virtual private network is a network that is constructed by using public wires usually the Internet to connect to a private network, such as a company's internal network. There are a number of systems that enable you to create networks using the Internet as the medium for transporting data. These systems use encryption and other security mechanisms to ensure that only authorized users can access the network and that the data cannot be intercepted.
A key feature of a VPN is its ability to work over both private networks as well as public networks like the Internet. Using a method called tunneling, a VPN runs over the same hardware infrastructure as existing Internet or intranet links. VPN technologies include various security mechanisms to protect the virtual, private connections.

2. (a) Draw the IP datagram header format. ―IP datagram has a checksum field still and it’s called an unreliable protocol. Justify. (6 Marks)
Ans:- 

A checksum of the IP header (excluding data). The IP checksum is computed as follows: 1. Treat the data as a stream of 16-bit words (appending a 0 byte if needed). 2. Compute the 1's complement sum of the 16-bit words. 3. Take the 1's complement of the computed sum. The IP service is connectionless because each packet is treated independently from all others. The service is unreliable because delivery is not guaranteed, and packets may well be lost, duplicated, delayed, or delivered out of order. Finally, the service is best-effort delivery because the software makes an earnest attempt to deliver packets; unreliability arises only when the resources are exhausted or the underlying networks fail. The key idea in IP is to keep the network relatively simple and put any necessary intelligence in the end hosts. The IP layer resembles the postal system.

(b) What is a ―internetworking? State and compare internetworking devices used to connect different LAN segments. (4 Marks) 
Ans: 
Internetworking is the practice of connecting a computer network with other networks through the use of gateways that provide a common method of routing information packets between the networks. The resulting system of interconnected networks is called an internetwork.
Repeater:-

  • A repeater connects different segments of a LAN. 
  • A repeater forwards every frame it receives.
  • A repeater is a regenerator, not an amplifier.
  • It can be used to create a single extended LAN. 
Bridge:-
A bridge is a device that separates two or more network segments within one logical network. A bridge is used for linking two networks that work with the same protocol (similar type network). It can filter frames to transmit it to destination address corresponds to a machine located on the other side of the bridge. It connects two or more local area networks (LANs) together.
  • A bridge operates both in physical and data-link layer 
  • A bridge uses a table for filtering/routing 
  • A bridge does not change the physical (MAC) addresses in a frame.
3. (a) Describe the activities to be performed at every layer in the TCP model when information flows from layer to another layer.(6 Marks) 
Ans: 
Application Layer:
The application layer provides format and configuration for the user to access information on the network through an application. This layer is the main interface for users to interact with the application and therefore the network.
Services:
  • Resource sharing and device redirection
  • Remote file access
  • Remote printer access
  • Network management
  • Directory services
  • Electronic messaging (such as mail) etc 
Presentation Layer:
The presentation layer transforms data to provide a standard interface for the application layer. Encoding, data compression, data encryption and similar manipulation of the presentation is done at this layer to present the data as a service or protocol developer sees fit.
Services:
  • Data representation
  • Data security
  • Data compression
Session Layer:
The session layer controls the connections (sessions) between computers. It establishes, manages and terminates the connections between the local and remote application. 
Services:
  • Simplex
  • Half Duplex
  • Full Duplex 
Transport Layer
The transport layer provides transparent transfer of data between end users, thus relieving the upper layers from transfer concerns while providing reliable data transfer. The transport layer controls the reliability of a given link through flow control, segmentation/ desegmentation, and error control. 
Services:-
  • Resource Utilization (multiplexing):
  • Connection Management (establishing & terminating
  • Flow Control (Buffering / Windowing):
Network Layer
The network layer provides the means of transferring data sequences from a source to a destination by using one or more networks while maintaining the quality of service requested by the Transport layer. The Network layer performs network routing functions, and might also perform segmentation/de-segmentation, and report delivery errors. 
Services:-
  • Connection setup
  • Addressing
  • Routing
  • Security
  • Quality of Service
  • Fragmentation 
Data Link Layer
The data link layer provides the means to transfer data between network entities and to detect and possibly correct errors that may occur in the Physical layer. It arranges bits from the physical layer into logical chunks of data, known as frames. 
Services:- 
  • Frame Traffic Control:
  • Frame Sequencing:
  • Frame Acknowledgment:
  • Frame Delimiting:
  • Link Establishment and Termination:
  • Frame Error Checking:
  • Media access management: 
Physical Layer
The physical layer defines all the electrical and physical specifications for devices. This includes the Layout of pins, voltages, and cable specifications. 
Services:-
  • Data encoding:
  • Transmission technique:
  • Physical medium transmission:

(b) Classify the problems faced by network administrator. Make a chart to explain the available solutions for each problem.(4 Marks) 
Ans: 
Flexibility vs. Security
Network security has had to adapt increasingly quickly, in order to keep up with the new ways those users and back-end systems work. Mobility and variety are currently on the increase at both sides of the enterprise network. At the outer edge, users are operating a growing range of hand-held computing devices. 
Cost vs. Capability 
New applications drive requirements for new capabilities within the network infrastructure:
  • Multimedia applications require enhancements to network QoS, and the introduction of multicasting protocols.
  • High-performance applications, for example high-definition video, high-end CAD and graphics applications, require enhancements to network bandwidth.
  • Migration to IPv6 requires the introduction of new protocols into the network.
Reliability vs. Growth 
Networks are growing not just in complexity, but also in size. As more and more functions converge onto data networks, the number of devices attached to the network grows, and therefore the number of switching and routing nodes in the network must also grow. Organizations need to attach more and more of their operations onto the data network – remote locations need connections into central sites; even locations with no staff need network links for surveillance cameras and/or environmental monitoring, and/or control of automated devices.
Solution
  • Efficient configuration change management
  • Automated recovery of failed units
  • Automatic provisioning of new units
  • Automated software upgrade 

4. (a) Explain the connection oriented & connection less services using bind, connect, listen & accept system calls. (6 Marks) 
Ans: 
Connection oriented service is implemented by Transmission Control Protocol (TCP). There are various characteristics of this protocol.
  • It is a connection-oriented.
  • A client must connect a socket to a server.
  • TCP socket provides bidirectional channel between client and server.
  • Lost data is re-transmitted.
  • Data is delivered in-order.
  • Data is delivered as a stream of bytes.
  • TCP uses flow control.
Connection less communication is implemented by User Datagram Protocol (UDP). Characteristics of this protocol:-
  • It is a connectionless.
  • A single socket can send and receive packets from many different computers.
  • Best effort delivery.
  • Some packets may be lost some packets may arrive out of order.

(b) List and explain the features of any four popular enterprise security solutions.(4 Marks) 
Ans: 
Enterprises security solution and its features:-
End Point Data Protection Features
  • Minimize risk of losing sensitive data.
  • Improve incident response time.
  • Identify security threads quickly with comprehensive correlations.
  • Reduce security operations costs with standardized process.
  • Leverage security intelligence to improve security posture
  • Security log data and detailed reports support your IT policy and regulatory compliance requirements
Disaster Recovery Features
  • Simple and easy to deploy
  • Pay per use business model
  • Best in class TCO for DR solutions
  • Continuous Data Protection technology with multi-site replication
  • DR protection from multiple geographic Data centers, 100% scalable to meet your production workloads
  • 24 X 7 support
Enterprise Data Protection
  • Protect your data wherever it goes — on devices, external media and in public cloud storage.
  • Implement encryption options ranging from simplified to full disk encryption.
  • Help your organization meet regulatory requirements and avoid costly fines with onetouch preset compliance templates.
  • Easily implement encryption with optional and customized factory installation.
  • Remotely manage encryption and authentication policies with a single console designed to work seamlessly.
  • Enable end users to securely access and share data on any device and in the cloud with non-disruptive, data-centric encryption.
End Use security Solution
  • Reduce cost and complexity of risk management
  • ITighter control and visibility of regulatory compliance
  • Provision appropriate network access for non employee
  • Mitigate the risk of end point vulnerabilities 

5.
(a) What is a mail server? Briefly explain specifying the protocols involved how a
sender can send a mail to the server and the recipient retrieves it from the server? (6
Marks)
ANs: 
An e-mail server is a computer within your network that works as your virtual post office. A
mail server usually consists of a storage area where e-mail is stored for local users, a set of
user definable rules which determine how the mail server should react to the destination of a
specific message
Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (e-mail)
transmission across Internet Protocol (IP) networks. SMTP is generally used to send
messages from a mail client to a mail server. This is why you need to specify both the POP
or IMAP server and the SMTP server when you configure your e-mail application.

  • After composing a message and hitting send, your email client - whether it's Outlook Express or Gmail - connects to your domain's SMTP server. This server can be named many things;
  • Your email client communicates with the SMTP server, giving it your email address, the recipient's email address, the message body and any attachments.
  • The SMTP server processes the recipient's email address - especially its domain. If the domain name is the same as the sender's, the message is routed directly over to the domain's POP3 or IMAP server - no routing between servers is needed. If the domain is different, though, the SMTP server will have to communicate with the other domain's server.
  • In order to find the recipient's server, the sender's SMTP server has to communicate with the DNS, or Domain Name Server. The DNS takes the recipient's email domain name and translates it into an IP address. The sender's SMTP server cannot route an email properly with a domain name alone; an IP address is a unique number that is assigned to every computer that is connected to the Internet. By knowing this information, an outgoing mail server can perform its work more efficiently.
  • Now that the SMTP server has the recipient's IP address, it can connect to its SMTP server. This isn't usually done directly, though; instead, the message is routed along a series of unrelated SMTP servers until it arrives at its destination.
  • The recipient's SMTP server scans the incoming message. If it recognizes the domain and the user name, it forwards the message along to the domain's POP3 or IMAP server. From there, it is placed in a send mail queue until the recipient's email client allows it to be downloaded. At that point, the message can be read by the recipient.

(b) Explain the importance of three-way handshake method for connection
establishment in TCP/IP with the help of suitable diagram.(4 Marks)
Ans: 
To establish a connection, TCP uses a three-way handshake. Before a client attempts to
connect with a server, the server must first bind to and listen at a port to open it up for
connections: this is called a passive open. Once the passive open is established, a client
may initiate an active open. To establish a connection, the three-way (or 3-step) handshake
occurs: 
1. SYN: A client sending a SYN to the server. The client sets the segment's sequence
number to a random value X.
2. SYN-ACK: In response, the server replies with a SYN-ACK. The acknowledgment
number is set to one more than the received sequence number (X + 1), and the
sequence number that the server chooses for the packet is another random number,Y.
3. ACK: Finally, the client sends an ACK back to the server. The sequence number is
set to the received acknowledgement value i.e. X + 1, and the acknowledgement
number is set to one more than the received sequence number i.e. Y + 1.

6.
(a) Draw the TCP header and list its components. Also, explain how can TCP handle urgent
data?
(6 Marks)
Ans: 
TCP provides a mechanism to handle urgent data
• Urgent data is received before octets already in the stream
• Sender:
– Sets urgent bit in segment header
– Puts urgent data at the beginning of the data field
– Sets urgent pointer to the end of the urgent data
• Receiver:
– Notified of the urgent data as soon as it arrives
– Enters “urgent mode” until all urgent data has been consumed
– Returns to “normal mode” 


(b) What do you understand by a domain name? How is a domain name translated to
an equivalent IP address?(4 Marks)
Ans: 
The Domain Name System (DNS) is a standard technology for managing the names of
Web sites and other Internet domains. DNS technology maps IP address with names like
“www.pixelesindia.com” and a computer automatically find that address on the Internet.
A DNS server is any computer registered to join the Domain Name System. A DNS
server runs special-purpose networking software, features a public IP address, and
contains a database of network names and addresses for other Internet hosts. There are
two types of DNS servers:-primary (master) and secondary DNS server.

  • It can supply the IP address because it knows it from its zone file.
  • It can contact another DNS server and try to locate the IP address for the name requested. Every DNS server has an entry called alternate DNS server, which is the DNS server it should get in touch with for unresolved domains. If this server is in authority, it responds, otherwise sends the query to another server. When the query is finally resolved, it travels back until it finally reaches the resolver. 

7.
(a) List the protocols presently supported by Intranet and explain the use of each
protocol in Intranet administration. (6 Marks)
Ans: 
HTTPd
It stands for HTTP daemon. A daemon is a UNIX background process that implements the
server side of a protocol. For example, FTPd is the File Transfer Protocol daemon. HTTP
daemon, a software program that runs in the background of a Web server and waits for
incoming server requests. The daemon answers the requests automatically and serves the
hypertext and multimedia documents over the Internet using HTTP. HTTPd is the program you would run on a UNIX platform to establish a web server. Daemons are unique to UNIX
on other platforms, such as Microsoft Windows NT, the web server is a background process
implemented as a system service.
SOCKS
SOCKS is an Intranet protocol that facilitates the routing of network packets between client–
server applications via a proxy server. SOCKS perform at Layer 5 of the OSI model—the
Session Layer Port 1080 is the well-known port designated for the SOCKS server.
The SOCKS5 protocol was originally a security protocol that made firewalls and other
security products easier to administer. It was approved by the IETF in 1996. The protocol
was developed in collaboration with Aventail Corporation, which markets the technology
outside of Asia. 
#ARP / RARP (Address resolution protocol & Reverse Address resolution
Protocol):- 
 It is a basic communication protocol that is used to identify IP address if physical
address is known. It is used by networking equipment.
It obtains the MAC address for requesting device. It is also used to translate MAC address to
IP address & vice-versa.
The Address Resolution Protocol uses a simple message format that contains one
address resolution request or response. The size of the ARP message depends on the
upper layer and lower layer address sizes, which are given by the type of networking
protocol (usually IPv4) in use and the type of hardware or virtual link layer that the upper
layer protocol is running on. The message header specifies these types, as well as the size
of addresses of each. The message header is completed with the operation code for request
(1) and reply (2). The payload of the packet consists of four addresses, the hardware and
protocol address of the sender and receiver hosts. 
#SSL Secure Socket Layer (SSL)
SSL are cryptographic protocols that provide security for
communications over networks such as the Internet. TLS and SSL encrypt the segments of
network connections at the Transport Layer end-to-end.
Several versions of the protocols are in widespread use in applications like web browsing,
electronic mail, Internet faxing, instant messaging and voice-over-IP (VoIP). 
# SSH
Secure Shell or SSH is a network protocol that allows data to be exchanged using
a secure channel between two networked devices. Used primarily on GNU/Linux and Unix
based systems to access shell accounts, SSH was designed as a replacement for Telnet
and other insecure remote shells, which send information, notably passwords, in plaintext,
rendering them susceptible to packet analysis. The encryption used by SSH provides
confidentiality and integrity of data over an insecure network, such as the Internet.
#RSH
The remote shell (rsh) is a command line computer program that can execute shell
commands as another user, and on another computer across a computer network.
The remote system to which rsh connects runs the rshd daemon. The rshd daemon typically
uses the well-known Transmission Control Protocol (TCP) port number 514.


(b) How many networks can each IP address class (A, B and C) can have? Calculate and
justify your answer using a suitable example for each. (4 Marks)
Ans: 



8.
(a) What is the purpose of DNS? What is the function of a secondary or tertiary DNS
server? In which case will the lookups be transferred to additional DNS servers?(6
Marks)
ANs: 
A DNS server is any computer registered to join the Domain Name System. A DNS
server runs special-purpose networking software, features a public IP address, and
contains a database of network names and addresses for other Internet hosts. There are
two types of DNS servers:-primary (master) and secondary DNS server. 
  • Primary server: - it is responsible creating, maintaining and updating zone file and it is stored in its local disk.
  • Secondary server: - Secondary server stores the latest zone file from the primary server only.
  • A primary DNS server holds the "master copy" of the data for a zone, and secondary servers have copies of this data which they synchronize with the primary through zone transfers at intervals or when prompted by the primary.
  • Only one DNS server should be configured as primary for a zone, but you can have any number of secondary servers for redundancy.
  • Both primary and secondary servers for a zone serve exactly the same data to clients.
  • Once a zone is configured on both primary and secondary servers, zone transfers should automatically occur when needed. 


(b) What are the NTFS, FAT, HPFS file systems?
Ans: 
NT File System, one of the file systems for the Windows NT operating system (Windows NT
also supports the FAT file system). NTFS has features to improve reliability, such as
transaction logs to help recover from disk failures. To control access to files, you can set
permissions for directories and/or individual files. NTFS files are not accessible from other
operating systems such as DOS. For large applications, NTFS supports spanning volumes,
which means files and directories can be spread out across several physical disks. 
The HPFS file system was first introduced with OS/2 1.2 to allow for greater access to the
larger hard drives that were then appearing on the market. Additionally, it was necessary for
a new file system to extend the naming system, organization, and security for the growing
demands of the network server market. HPFS maintains the directory organization of FAT,
but adds automatic sorting of the directory based on filenames. Filenames are extended to
up to 254 double byte characters. HPFS also allows a file to be composed of "data" and
special attributes to allow for increased flexibility in terms of supporting other naming
conventions and security. In addition, the unit of allocation is changed from clusters to
physical sectors (512 bytes), which reduces lost disk space.

Monday, 24 August 2015

RAILWAY RESERVATION SYSTEM

1. INTRODUCTION:

1.1. PURPOSE:
The purpose of this source is to describe the railwayreservation system which provides the train timing details, reservation,billing and cancellation.

1.2. DOCUMENT CONVENTIONS:
Main headings: Bold
Not applicable

1.3INTENDED AUDIENCE AND READING SUGGESTIONS:
The different types of readers are:
Customers
Developers
Management people.

1.4PROBLEM DIFINITION AND PRODUCT SCOPE:
It consists of  
Train details
Reservation form
Billing
Cancellation.

2. OVERALL DESCRIPTION:

2.1. PRODUCT PERSPECTIVE:
It enables us to maintain the railway train details like their timings,number of seat available and reservation billing and cancelling the tickets.

2.2. PRODUCT FUNCTIONS:
It tells the short note about the product.

2.2.1. TRAIN DETAILS:
Customers may view the train timing at a date their nameand number of tickets.

2.2.2. RESERVATION:
After checking the number of seats available thecustomers reserve the tickets.

2.2.3. BILLING:
After reserving the required amount of tickets, thecustomer paid the amount.

2.2.4. CANCELLATION:
If the customers want to cancel the ticket, then half of theamount paid by the customer will be refunded to him.

3. USER CLASS AND CHARACTERISTICS:
Knowledgeable user
Novice user
Expert user

4. OPERATING ENVIRONMENT:
The OS types are
Windows NT
Windows XP
Windows 98
Linux

5. SOFTWARE CONSTRAINTS:
Designing -> Rational RoseDeveloping -> Visual Basic

6. USER DOCUMENTATION:
USER MANUAL:
Manual helps to understand the product details abouthow to work.
TUTORIALS:For beginners use.

7. EXTERNAL INTERFACE REQUIREMENTS:

7.1. USER INTERFACE:
Keyboard and Mouse.

7.2. HARDWARE INTERFACE:
Printer
Normal PC

7.3. SOFTWARE INTERFACE: 
Front end -> Visual Basic
Back end -> MS-Access

8. OTHER NON-FUNCTIONAL REQUIREMENTS:

8.1. PERFORMANCE REQUIREMENTS:
It is available during all 24 hours.

8.2. SOFTWARE SYSTEM ATTRIBUTES:
Reliable
Available
Secure


DATA FLOW DIAGRAM
Data Flow Diagram (DFD) is used widely for modelingthe requirement.
They have been used for many yearsprior to the advent of computer. DFDs show the flow of data through the system.
The system may be a company,an organization, a set of procedural, a computer hardwaresystem, a software system, or any combination of thepreceding.

Case diagram


Level 1 Data Flow Diagram :-




Question 3. How will you comment about the quality of a Software System? (20 Marks)
Ans: 
Software quality may be defined as conformance to explicitly stated functional and performance
requirements, explicitly documented development standards and implicit characteristics that are
expected of all professionally developed software.


The three key points in this definition: 

  • Software requirements are the foundations from which quality is measured. Lack of conformance to requirement is lack of quality.
  • Specified standards define a set of development criteria that guide the manager is software engineering. If criteria are not followed lack of quality will usually result.
  • A set of implicit requirements often goes unmentioned, for example ease of use, maintainability etc. If software confirms to its explicit requirement but fails to meet implicit requirements, software quality is suspected. 

Software Quality Factors
A software quality factor is a non-functional requirement for a software program, which is not
called up by the customer's contract, but it is a desirable requirement that enhances the quality
of the software program. Some software qualities factors are listed here:-
McCall Software Quality Model 

Product operation: 
Factors which are related to the operation of a product are combined.
These five factors are related to operational performance, convenience, ease of usage and its
correctness. 

The factors are:
  • Correctness: Extent to which a program satisfies its specifications and fulfils the user’s mission objectives.
  • Efficiency: Amount of computing resources and code required by a program to perform a function.
  • Integrity: Extent to which access to software or data by unauthorized persons can be controlled.
  • Reliability: Extent to which a program can be expected to perform its intended function with required precision.
  • Usability: Effort required learning, operating, preparing input and interpreting output of a program. 
Product Revision: These factors pertain to the testing & maintainability of software. They give
us idea about ease of maintenance, flexibility and testing effort.
Factors are:-
  • Maintainability: Effort required for locating and fixing a defect in an operational program.
  • Flexibility: Effort required for modifying an operational program.
  • Testability: Effort required for testing a program to ensure that it performs its intended functions.
Product Transition: We may have to transfer a product from one platform to another
platform or from one technology to another technology. The factors are given below:-
  • Portability: Effort required transferring a program from one hardware and/or software environment to another.
  • Reusability: Extent to which parts of a software system can be reused in other applications.
  • Interoperability: Effort required to couple one system with another. 
ISO 9126 Software Quality Model
There are six factors:-
Functionality has been subdivided into:
  • Suitability
  • Accuracy
  • Interoperability: The capability of the software to interact with one or more specified systems.
  • Security
Reliability has been subdivided into:
  • Maturity: The capability of the software to avoid failure as a result of faults in the software.
  • Fault Tolerance:
  • Recoverability:
Usability has been subdivided into: 
  • Understandability
  • Learnability
  • Operability
  • Attractiveness
Efficiency has been subdivided into:
  • Time Behaviour
  • Resource Utilization:
Maintainability has been subdivided into:
  • Analyzability: The capability of the software product to be diagnosed for deficiencies or causes of failures in the software or for the parts to be modified to be identified.
  • Changeability:
  • Stability: The capability of the software to minimize unexpected effects from modifications of the software.
  • Testability
Portability has been subdivided into:
  • Adaptability:
  • Installability
  • Coexistence
  • Replaceability

Monday, 23 March 2015

Q1 Ten individuals are chosen at random, from a normal population and their weights (in kg) are found to be 63, 63, 66, 67, 68, 69, 70, 70, 71 and 71. In the light of this data set, test the claim that the mean weight in population is 66 kg at 5% level of significance.
Ans. Weighted mean = Σwx/Σw
Σ = the sum of (in other words…add them up!).
w = the weights.
x = the value.
To use the formula:
  1. Multiply the numbers in your data set by the weights.
  2. Add the numbers in Step 1 up. Set this number aside for a moment.
  3. Add up all of the weights.
  4. Divide the numbers you found in Step 2 by the number you found in Step 3.
Mean weight = 67.8 kg
Standard deviation = 8.16 kg
Z = (67.9 – 66) /8.16 kg = 0.2328
ZTable(Z) = 0.091      it is 9.1 % significance level.
So the claim that the mean weight in the population is 66 kg at 5% level of significance is WRONG.
Q2 I bought two packets of apples, 25 in each packet. The mean and standard deviation of weights of apples in the first packet are 235 and 3; and the mean and standard deviation for the second packet are 237.5 and 4. Write down the mean and standard deviation formulae for all the fifty
apples and compute them.
Ans. Apples in Each Packets – 25
Mean of First Packets – 235
Standard Daviation of Weight is – 3
Mean of second Packets – 237.5
Standard Daviation of Weight of second packets is – 4
Mean and Standard Deviation for all fifty apples are :
mean = Σwx/Σw
mean of Total = Σ(235 X3 )/Σ(237.5 X 4)
= 705/950
= 0.74
Q3 A consumer research organization tests three brands of tires to see how many miles they can be driven before they should be replaced. One tyre of each brand is tested in each of five types of cars. The results (in thousands of miles) are as follows: (10)
Type of car Brand A Brand B Brand C
I           6 9 4
II         3 2 7
III        2 3 6
IV        8 8 5
V         9 1 8
Compute the ANOVA and interpret your result.
Ans.
STEP 1:
Do the ANOVA table
d.fit <- aov(v~TR,data=d)
summary(d.fit)
Interpretation:
Makes an ANOVA table of the data set
d
, analysing if the factor
TR
has a signi
cant e
ect on
v
.
The function
summary
shows the ANOVA table.
> summary(d.fit)
Df Sum Sq Mean Sq F value Pr(>F)
TR 2 26.1667 13.0833 35.682 0.001097 **
Residuals 5 1.8333 0.3667

Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
STEP 2:
Decision:
Interpretation:
Exactly the same as for the “by hand” calculated tableWith
R
we do not have the critical values to a level, but we have the P
Q4 A building has 11 flats. A sample of 4 flats is to be selected using (i) linear systematic sampling and (ii) circular systematic sampling. List all possible samples for each of these cases (10)
separately.
N = 11
n = 4
N/n = 11/4 =2.75      nearest integer = 3
let k = 3
1) Linear systematic sampling
Let i = 1,  sample : 1, 4, 7, 10
i = 2,  sample :   2, 5 , 8 , 11
i =3 ,  sample :    3, 6, 9
2)  Circular systematic sample:
i = 1, sample:  1, 4,7,10
2                2,5,8, 11
3                 3,6,9,1
4                 4,7,10,2
5                 5, 8, 11, 3
6                 6,9,1, 4
7                 7,10,2,5
8                 8,11,3,6
9                 9,1,4,7
10               10,2,5,8
11,              11,3,6,9
Q5 Calculate Probabilities for following situations :
a) There are 1000 pages in a book out of which 100 pages are defective. What is the probability that out of first 50 pages 10 pages will be defective?
AnsProbability Functions
A probability function is a function which assigns probabilities to the values of a random variable.
  • All the probabilities must be between 0 and 1 inclusive
  • The sum of the probabilities of the outcomes must be 1.
If these two conditions aren’t met, then the function isn’t a probability function. There is no requirement that the values of the random variable only be between 0 and 1, only that the probabilities be between 0 and 1.
Probability Distributions
A listing of all the values the random variable can assume with their corresponding probabilities make a probability distribution.
A note about random variables. A random variable does not mean that the values can be anything (a random number). Random variables have a well defined set of outcomes and well defined probabilities for the occurrence of each outcome. The random refers to the fact that the outcomes happen by chance — that is, you don’t know which outcome will occur next.
Here’s an example probability distribution that results from the rolling of a single fair die.
x123456sum
p(x)1/61/61/61/61/61/66/6=1

Mean, Variance, and Standard Deviation
Consider the following.
The definitions for population mean and variance used with an ungrouped frequency distribution
BCS-040_1
Some of you might be confused by only dividing by N. Recall that this is the population variance, the sample variance, which was the unbiased estimator for the population variance was when it was divided by n-1.

What’s even better, is that the last portion of the variance is the mean squared. So, the two formulas that we will be using are:BCS-040_2
BCS-040_3
x123456sum
p(x)1/61/61/61/61/61/66/6 = 1
x p(x)1/62/63/64/65/66/621/6 = 3.5
x^2 p(x)1/64/69/616/625/636/691/6 = 15.1667
The mean is 7/2 or 3.5
The variance is 91/6 – (7/2)^2 = 35/12 = 2.916666…
The standard deviation is the square root of the variance = 1.7078
Q 5 b) A die is tossed twice. Getting an odd number in at least a toss is termed as a success. Find the probability distribution of number of successes. Also find expected number of successes.
Ans. Let S = event that at least an odd number is the outcome of n tosses. = success
Let F = event that no odd number turns out = failure
n =1, then in one toss, probability of an odd number turning out = 3/6 = 1/2
P(S) = 1/2   So P(F) = 1 – 1/2 = 1/2
The tosses of die are independent. The probabilities can be multiplied.
n = 2, two tosses,  P(S) = 1 –  ( P(Failure) in first toss * P(Failure) in 2nd toss)
= 1  – 1/2 * 1/2 = 1 – 1/4 = 3/4
probability distribution is
P(n,X) :   = 0   for n = 0
=  1/2  for  n = 1
=  3/4  for  n = 2
Q 5 c) Find the probability that at most 5 defective fuses will be found in a box of 200, if experience shows that 20% of such fuses are defective.
Ans. 20%of 200=40
so there are 40 fuses which are defective
the probability of finding 5 defectives= 5/40=1/8
Q6 Following data are given for marks in subject A and B in a certain examination :
SUBJECT A     SUBJECT B
MEAN MARKS                       36                               85
STANDARD DEVIATION      11                               8
Coefficient of correlation between A and B = ±0.66
  1. i) Determine the two equations of regression
  2. ii) Calculate the expected marks in A corresponding to 75 marks obtained in B
Ans. i)
The Regression Line
With one independent variable, we may write the regression equation as:
BCS-040_4
Where Y is an observed score on the dependent variable, a is the intercept, b is the slope, X is the observed score on the independent variable, and e is an error or residual.
We can extend this to any number of independent variables:
BCS-040_5
Note that we have k independent variables and a slope for each. We still have one error and one intercept. Again we want to choose the estimates of a and b so as to minimize the sum of squared errors of prediction. The prediction equation is:
BCS-040_6
Finding the values of b is tricky for k>2 independent variables, and will be developed after some matrix algebra. It’s simpler for k=2 IVs, which we will discuss here.
For the one variable case, the calculation of b and a was:
BCS-040_7
At this point, you should notice that all the terms from the one variable case appear in the two variable case. In the two variable case, the other X variable also appears in the equation. For example, Xappears in the equation for b1. Note that terms corresponding to the variance of both X variables occur in the slopes. Also note that a term corresponding to the covariance of X1 and X2 (sum of deviation cross-products) also appears in the formula for the slope.
The equation for a with two independent variables is:
BCS-040_8
This equation is a straight-forward generalization of the case for one independent variable
Ans.6 ii)In a cross between two heterozygous individuals, the offspring would be expected to show a 3 : 1 ratio. For example, in Case 1, three-fourths of the individuals would have red (wild-type) eyes, and one-fourth would have sepia eyes.
If there are 44 offspring, how many are expected to have red eyes?
We expect three-fourths to have red eyes.
If there are 44 offspring, how many are expected to have sepia eyes?

Q7A sample of 900 members has a mean 3.4 cm and standard deviation 2.61 cm. Test whether the sample is from a large population of mean 3.25 cm and standard deviation 2.61 cm. If the population is normal and its mean is unknown, find the 95% confidence interval for population mean.
Ans.
N_s = sample size = 900.         Î¼_s = mean of the sample = 3.4 cm
σ_s = Standard deviation of the sample = 2.61 cm
Population mean Î¼₀ =3.25
Population standard deviation = Ïƒ₀ = 2.61 cm
student’s t = (μ_s – Î¼₀) / [σ_s / √N_s ]
t  = (3.4 – 3.25) * √900 / 2.61 = 1.7241
Find the probability that     -1.7241 <= t <= 1.7241     from the students t distribution table or from a website that calculates these. Here the degrees of freedom (d.f) are 899.  Sample size is 900.
The probability  is 0.915.  Hence,  the sample belongs to the population with a probability 0.915  or  a  confidence level of 91.5%.
The population is normal.  we don’t  know its mean. We know sample size, mean and standard deviation.
Z = (μ_s – Î¼₀) / Ïƒ
Here Ïƒ_s = 2.61  cm
The value z of normal distribution variable Z for which the probability
P( -z < Z < z) = 95% = 0.95   is  z = 1.96
-1.96 * Ïƒ_s <= (μ_s – Î¼₀) <= 1.96 * Ïƒ_s
– 5.1156 <= (μ_s – Î¼₀) <= 5.1156 cm
If we take the value of Î¼_s = 3.4 cm then,
-1.7156  <= Î¼₀ <= 8.5156  cm
Q8 The mean yield for one acre plot is 662 kg with a s.d. 32 kg. Assuming normal distribution, how many one acre plot in a batch of 1000 plots would your expect to have yield between 600 and 750 kg.
Ans.The mean yield for one acre plot is 662 kg with a s.d 32kg .assuming normal distribution how many one acre plot in a batch of 1000 plots would your expect to have yield between 600 and 750 kg.