Professional Documents
Culture Documents
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM:
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
22 - 06 - 2015
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Namespace: The namespace is a keyword that defines a distinctive name or last name for
the class. A namespace categorizes and organizes the library (assembly) where the class
belongs and avoids collisions with classes that share the same name.
Class declaration: Line of code where the class name and type are defined.
Constructors: A method or group of methods that contains code to initialize the class.
Events: Program responses that get fired after a user or application action.
Destructor: A method that is called when the class is destroyed. In managed code, the
Garbage Collector is in charge of destroying objects; however, in some cases developers
need to take extra actions when objects are being released, such as freeing handles or
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Public: Allows access to the class member from any other class.
Private: Allows access to the class member only in the same class.
Protected: Allows access to the class member only within the same class and from
inherited classes.
Internal: Allows access to the class member only in the same assembly.
Protected internal: Allows access to the class member only within the same class, from
inherited classes, and other classes in the same assembly.
Static: Indicates that the member can be called without first instantiating the class.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM #1:
Module classdemo
Class stud
Dim rno As Integer
Dim nm As String
Sub getdata()
Console.writeLine(enter roll no and name for the student:)
Rno=Console.ReadLine
nm=Console.ReadLine
End sub
Sub disp()
Console.writeLine(ROLL NO:&RNO)
Console.writeLine(NAME:&nm)
End sub
End class
Sub main()
Dim K As New stud
K.getdata()
K.disp()
Console.ReadLine()
End sub
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
INPUT:
Enter roll no and name for the student: 1
Ram
Enter roll no and name for the student: 2
Sam
Enter roll no and name for the student: 3
Jam
OUTPUT:
Roll no: 1
Name: Ram
Roll no: 2
Sam
Roll no: 3
Jam
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM #2:
Module classdemo
class stud
Dim rno As Integer
Dim nm As String
Dim m1 As Integer
Dim m2 As Integer
Dim m3 As Integer
Dim per As Double
Sub getdata()
Console.WriteLine(enter roll num and name of the student:)
Rno=Console.ReadLine
nm=Console.ReadLine
Console.WriteLine(enter 3 sub marks of the student)
m1=Console.ReadLine
m2=Console.ReadLine
m3=Console.ReadLine
End sub
Sub calc()
Dim sum As Integer
Sum=m1+m2+m3
Per=(sum/300)*100
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
INPUT:
Enter roll no and name for the student:
1
Ram
enter 3 sub marks of the student:
80
60
60
OUTPUT:
B.ZC
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
//not allowed
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
OUTPUT:
Abstract class method
Child class method
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
OUTPUT:
final class method
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
xx-xx-2015
PROGRAM:
Module inherit1
Class c1
Dim n1,n2 As Integer
Sub getdata()
Console.WriteLine(enter number 1 & 2:)
n1=Console.ReadLine
n2=Console.ReadLine
End sub
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
OUTPUT:
Welcome
Bye
P1
P2
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM:
namespace PolymorphismByManishAgrahari
{
class Program
{
public class Base
{
public class Derived : Base
{
//the keyword "override" change the base class method.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
OUTPUT: Show From Derived Class
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace MyWebProject
{
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM:
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ListBox AutoPostBack Example</title>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
INPUT:
OUTPUT:
22- 06 - 2015
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
An Exception is
an
object
delivered
by
This Exception class is exposed by the System.Exception namespace. Exceptions are used to
avoid system failure in an unexpected manner.Exception handles the failure situation that may
arise. All the exceptions in the .NET Framework are derived from the System.Exception class.
To understand exception, we need to know two basic things:
1. Somebody sees a failure situation that happened and throws an exception by packing the
valid information.
2. Somebody who knows that a failure may happen catches the exception thrown. We call
it ExceptionHandler.
Handling Exception:
To handle the exception, we need to place the code within the try block. When an exception
occurs inside the try block, the control looks for the catch block and raises an exception that is
handled in the catch block. Below is the simple skeleton for the try and catch block:
try
{
}
catch
{
//Raised exception Handled here
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
OUTPUT:
Enter 2 numbers
2
0
//error will be displayed at the line res=n1/n2
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
INPUT:
Enter any 2 numbers
10
0
OUTPUT:
Divide by zero is not possible
It is finally block
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
22 06 - 2015
AIM: Develop a simple application where a windows client can interact with
a web service.
EXPLANATION: Web Service is an application that is designed to interact directly with
other applications over the internet. In simple sense, Web Services are means for interacting with
objects over the Internet. The Web serivce consumers are able to invoke method calls on remote
objects by using SOAP and HTTP over the Web. WebService is language independent and Web
Services communicate by using standard web protocols and data formats, such as
HTTP
XML
SOAP
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM STEPS:
1. Start a new website with Default.aspx web page.
2. Right click in Solution explorer => Add New item => Select Web Service.
a) Give the name myWebService to the web service.
b) (i) One file gets created in App_Code folder with extension .vb.
(ii) Second gets created in application folder with extension .asmx.
3. Steps for creating web services:
a) Write a user defined methods in myWebService.vb.
For e.g.:
<WebMethod()> _
Public Function myFunction() As String
Return "This myFunction in Webservice"
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
PROGRAM:
Inline code( Default.aspx.vb)
Imports System.Web.Services
Partial Class _Default
Inherits System.Web.UI.Page
Dim mt As New myWebService 'Creating an object webservice
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
HandlesMe.Load
Response.Write(mt.myFunction()) 'Using the method of respective web service
End Sub
End Class
Webservice( myWebSerivce.vb)
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
EXECUTION:
INPUT:
OUTPUT:
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
VIVA QUESTIONS
1. What is ASP.Net?
Ans: It is a framework developed by Microsoft on which we can develop new generation web
sites using web forms(aspx), MVC, HTML, Javascript, CSS etc. Its successor of Microsoft
Active Server Pages(ASP). Currently there is ASP.NET 4.0, which is used to develop web sites.
There are various page extensions provided by Microsoft that are being used for web site
development. Eg: aspx, asmx, ascx, ashx, cs, vb, html, XML etc.
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
<configuration>
<system.web>
<pages theme="Windows7" />
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
7. What is MVC?
Ans: MVC is a framework used to create web applications. The web application base builds on
Model-View-Controller pattern which separates the application logic from UI, and the input and
events from the user will be controlled by the Controller.
<asp:Login>: Provides a standard login capability that allows the users to enter their
credentials
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Application
Request
Response
Server
Session
Context
Trace
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command,
connection.
17. What are the different Session state management options available in
ASP.NET?
Ans:
1. In-Process
2. Out-of-Process.
In-Process stores the session in memory on the web server.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
20. What is the difference between web config and machine config?
Ans: Web config file is specific to a web application where as machine config is specific to a
machine or server. There can be multiple web config files into an application where as we can
have only one machine config file on a server.
All the websites can be accessed using single login credentials. So no need to remember
login credentials for each web site.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Client-side validations happends at the client's side with the help of JavaScript and
VBScript. This happens before the Web page is sent to the server.
Authentication is the process of verifyng the identity of a user using some credentials like
username and password while authorization determines the parts of the system to which a
particular identity has access.
For e.g. If an employee authenticates himself with his credentials on a system, authorization will
determine if he has the control over just publishing the content or also editing it.
These are the objects on ASP.NET pages that run when the Web page is requested.
Some of these Web server controls, like button and text box, are similar to the HTML
controls.
Some controls exhibit complex behavior like the controls used to connect to data sources
and display data.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Content files: Content files include static text, images and can include elements from
database.
Program logic: Program logic files exist as DLL file on the server that responds to the
user actions.
Configuration file: Configuration file offers various settings that determine how the
application runs on the server.
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Abstract cannot be instantiated but we can inherit. Interface it cannot be inherit it can be
instantiate.
Public is default access specifier for interface we dont have a chance to declare other
specifiers. In abstract we have chance to declare with any access specifier.
Function returns only one value but procedure returns one or more than one value.
Function can be utilized in select statements but that is not possible in procedure.
Procedure can have an input and output parameters but function has only input
parameters only.
Exceptions can be handled by try catch block in procedures but that is not possible in
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE
Prepared by
Approved by
Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE