Anda di halaman 1dari 50

G.

NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Title: String Manipulation
DATE: 22 06 - 2015
AIM: Write a program to implement string manipulation.
EXPLANATION:
String Functions in ASP.NET:
Following are the string functions used for string manipulation in asp.net.
GetChar("This is a string", 7) returns "s".
InStr() Returns the starting position in a string of a substring, counting from 1.
InStr("This is a string", "string") returns 11.
InStrRev() Returns the starting position in a string of a substring, searching from the end of the
string.
InStr("This is a string", "string") returns 11.
LCase() Returns the lower-case conversion of a string.
LCase("THIS IS A STRING") returns "this is a string".
Left() Returns the left-most specified number of characters of a string.
Left("This is a string", 4) returns "This".
Len() Returns the length of a string.
Len("This is a string") returns 16.
LTrim() Removes any leading spaces from a string.
LTrim(" This is a string") returns "This is a string".
Mid() Returns a substring from a string, specified as the starting position (counting from 1)
and the number of characters.
Mid("This is a string", 6, 4) returns "is a".

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
1

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Replace() Replaces all occurences of a substring in a string.
Replace("This is a string", " s", " longer s") returns "This are a longer string" (replaces an "s"
preceded by a blank space).
Right() Returns the right-most specified number of characters of a string.
Right("This is a string", 6) returns "string".
RTrim() Removes any trailing spaces from a string.
RTrim("This is a string ") returns "This is a string".
Str() Returns the string equivalent of a number.
Str(100) returns "100".
Space() Fills a string with a given number of spaces.
"This" & Space(5) & "string" returns "This string".
StrComp() Compares two strings. Return values are 0 (strings are equal), 1 (first string has the
greater value), or -1 (second string has the greater value) based on sorting sequence.
StrComp("This is a string", "This string") returns -1.
StrReverse() Reverses the characters in a string.
StrReverse("This is a string") returns "gnirts a si sihT".
Trim() Removes any leading and trailing spaces from a string.
Trim(" This is a string ") returns "This is a string".
UCase() Returns the upper-case conversion of a string.
UCase("This is a string") returns "THIS IS A STRING".
Val() Converts a numeric expression to a number.
Val( (1 + 2 + 3)^2 ) returns 36.

PROGRAM:

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
2

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Remove all the special characters from a Given String.
[1] Finding Special Character
public static string Slugify(string phrase)
{
String str = Regex.Replace(phrase, @"[^a-z0-9\s-]", " ");
str = Regex.Replace(str, @"\s+", " ").Trim();
return str;
}
For Replace Special Characters
public static string RemoveSpeCharacter(string str)
{
return Regex.Replace(str, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);
}
protected void Button1_Click(object sender, EventArgs e)
{
string str=TextBox1.Text;
TextBox2.Text=RemoveSpelCharacter(str);
}
Or
using System;
using System.Text.RegularExpressions;
namespace eApplication3
{
class Program
{

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
3

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


static void Main(string[] args)
{
string str = "DotNet@Spider.com";
string replacestr= Regex.Replace(str, "[^a-zA-Z0-9_]+", " ");
Console.WriteLine(replacestr);
Console.ReadLine();
}
}
}
Or
public string RemoveSpecialChars(string str)
{
string[] chars = new string[]{",",".","/","!","@","#","$","%","^","&","*","'","\"",";","","_","(",")",":","|","[","]"};
for(int i = 0; i< chars.Length; i++ )
{
if(str.Contains(chars[i]))
{
str = str.Replace(chars[i],"");
}
}
return str;
}
string newString = RemoveSpecialChars("T!h^e%c!od#e&i's#s;u$b%m|i%t(te)d by
M[o:h]i)t@Ja*i}n");

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
4

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


EXECUTION:
INPUT:
OUTPUT:

Title: Class Concept

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

Dr. K.V.G Rao


Prof & HOD CSE
5

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


AIM: Write a program to implement class concept.
EXPLANATION: A Class is a collection of objects holding similar behavior. The most
common definition states that a class is a template for an object.
Class members
A class has different members, and developers in Microsoft suggest to program them in the
following order:

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.

Fields: Set of variables declared in a class block.

Constants: Set of constants declared in a class block.

Constructors: A method or group of methods that contains code to initialize the class.

Properties: The set of descriptive data of an object.

Events: Program responses that get fired after a user or application action.

Methods: Set of functions of the class.

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

Dr. K.V.G Rao


Prof & HOD CSE
6

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


deallocating unmanaged objects. In .NET, there is no concept of deterministic destructors.
The Garbage Collector will call the Finalize() method at a non-deterministic time while
reclaiming memory for the application.
Access keywords
Access keywords define the access to class members from the same class and from other classes.
The most common access keywords are:

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

Dr. K.V.G Rao


Prof & HOD CSE
7

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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

Dr. K.V.G Rao


Prof & HOD CSE
8

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


End Module

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

Dr. K.V.G Rao


Prof & HOD CSE
9

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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

Dr. K.V.G Rao


Prof & HOD CSE
10

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Console.WriteLine(per:&per)
End sub
Sub disp()
Console.WriteLine(Roll no: &rno)
Console.WriteLine(Name:&nm)
If(per>70) then
Console.WriteLine(B.Sc)
Else If(per>60 And per<70)Then
Console.WriteLine(B.ZC)
Else
Console.WriteLine(B.Com)
End If
End sub
End class
Sub main()
Dim k As new stud
k.getdata()
k.calc()
k.disp()
console.ReadLine()
End sub
End module

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
11

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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

Dr. K.V.G Rao


Prof & HOD CSE
12

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

PROGRAM FOR ABSTRACT CLASS:


Module abs_class
MustInherit class c1
Sub p1()
Console.WriteLine(abstract class method)
End Sub
End class
Class child
Inherits c1
Sub p2()
Console.WriteLine(child class method)
End sub
End class
Sub main()
Dim k As New c1

//not allowed

Dim k as New child


k.p1()
k.p2()
Console.ReadLine()
End Sub
End module

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
13

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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

Dr. K.V.G Rao


Prof & HOD CSE
14

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

PROGRAM FOR FINAL CLASS:


Module final_class
NotInheritable class c1
Sub p1()
Console.WriteLine(final class method)
End sub
End class
Sub main()
Dim k As New c1
k.p1()
Console.ReadLine()
End sub
End module

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

Dr. K.V.G Rao


Prof & HOD CSE
15

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Title: Inheritance

xx-xx-2015

AIM: Write a program to implement Inheritance.


EXPLANATION: Acquiring the properties of existing class in to new class. Inheritance is a
feature that allows to extend a class. If you need some functionality, you can create a brand new
class. If part of the functionality you need has been provided a in a class written by someone
else, however, you can then write a new class that extends the original class. Your class is called
the child class or derived class, and the original class is called the parent class or the base class.
The process of extending a class is called extension. Sometimes, the term subclass or inherit is
used to describe the act of extending a class. In VB.NET a class can only extend one parent class.
Multiple class inheritance is no allowed in VB.NET. Syntactically, extending a class is done
using a semicolon after the class name, followed by the word Inherits and the parent class name.

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

Dr. K.V.G Rao


Prof & HOD CSE
16

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Sub dispdata()
Console.WriteLine(n1 &n1)
Console.WriteLine(n2 &n2)
End sub
End class
Class c2
Inherits c1
Dim z As Integer
Sub getz()
Console.WriteLine(enter value for z:&z)
End sub
Sub dispz()
Console.WriteLine(z:&z)
End sub
End class
Sub main()
Dim k As New c2
k.getdata()
k.dispdata()
k.getz()
k.dispz()
Console.ReadLine()
End sub
End Module

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
17

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


EXECUTION:
OUTPUT:
Enter number 1 and 2
10
20
Enter value of z: 2
2

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
18

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


PROGRAM FOR IMPLEMENTING INTERFACE CONCEPT:
Module interface1
Interface i1
Subp1()
Subp2()
End Interface
Class c2
Implements i1
Public sub p1()Implements i1.p1
Console.WriteLine(p1)
End Sub
Public sub p2()Implements i1.p2
Console.WriteLine(p2)
End sub
End class
Class par
Implements i1
Public sub p1() Implements i1.p1
Console.WriteLine(welcome)
End sub
Public sub p2() Implements i1.p2
Console.WriteLine(bye)
End sub
End class
Sub main()

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
19

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Dim K As New c2
Dim k1 As New par
K1.p1()
K1.p2()
k.p1()
k.p2()
Console.ReadLine()
End sub
End Module

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

Dr. K.V.G Rao


Prof & HOD CSE
20

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Title: polymorphism
xx xx - 2015
AIM: Write a program to implement polymorphism.
EXPLANATION: Polymorphism means one name many forms. Polymorphism means one
object behaving as multiple forms. One function behaves in different forms. In other words,
"Many forms of a single object is called Polymorphism."
Real World Example of Polymorphism

A Teacher behaves with student.

A Teacher behaves with his/her seniors.

Here teacher is an object but the attitude is different in different situations.


With polymorphism, the same method or property can perform different actions depending on
the run-time type of the instance that invokes it.
There are two types of polymorphism:
1. Static or compile time polymorphism
2. Dynamic or runtime polymorphism

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
21

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

PROGRAM:
namespace PolymorphismByManishAgrahari
{
class Program
{
public class Base
{
public class Derived : Base
{
//the keyword "override" change the base class method.

public override void Show()


{
Console.WriteLine("Show From Derived Class.");
}
}
static void Main(string[] args)

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
22

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


{
Base objBaseRefToDerived = new Derived();
objBaseRefToDerived .Show();//Output--> Show From Derived Class.
Console.ReadLine();
}
}
}
}

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

Dr. K.V.G Rao


Prof & HOD CSE
23

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Title: Web Application
xx xx- 2015
AIM: Write a program to create a web application.
EXPLANATION: A web application in ASP.NET is a collection of pages, controls, code
modules, and services all running under a single web server application directory (usually IIS).
ASP.NET makes it really easy to build the types of dynamic web applications that exist
everywhere on the Internet today. It provides a simple programming model based on the .NET
Framework and several built-in controls and services that enable many of the common scenarios
found in most applications, with very little effort or code.

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

Dr. K.V.G Rao


Prof & HOD CSE
24

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


public partial class _Default : System.Web.UI.Page
{
protected void Page _Load(object sender, EventArgs e)
{
// Run only on first page load
if(Page.IsPostBack==false)
{
Calender1.SelectedDate=DateTime.Now;
Label1.Text=Please select a date using the calendar;
}
}
}
}

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
25

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


EXECUTION:
OUTPUT:

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
26

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Title: Autopost Back and Web Control Events.
22-06- 2015
AIM: Write a program to implement Autopost Back and Web control events.
EXPLANATION: Autopostback is the mechanism, by which the page will be posted back to the
server automatically based on some events in the web controls. In some of the web controls, the
property called auto post back, which if set to true, will send the request to the server when an event
happens in the control.
For example,
Dropdown Box (Combo box) web control has the property autopostback.If we set the property to
true, when ever user selects a different value in the combo box, and event will be fired in the server.
i.e. a request will be send to the server.

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

Dr. K.V.G Rao


Prof & HOD CSE
27

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


if (ListBox1.SelectedItem != null)
Label1.Text = "You selected: " + ListBox1.SelectedItem.Value;
else
Label1.Text = "";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>ListBox AutoPostBack Example</h3>
Select an item from the list box: <br /><br />
<asp:ListBox id="ListBox1"
Rows="4"
AutoPostBack="True"
SelectionMode="Single"
runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:ListBox>
<br /><br />
<asp:Label id="Label1"

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
28

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


runat="server"/>
</form>
</body>
</html>

EXECUTION:
INPUT:
OUTPUT:

TITLE: Error Handling

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

Dr. K.V.G Rao


Prof & HOD CSE
29

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


AIM: Write a program to implement handle errors.
EXPLANATION:

An Exception is

an

object

delivered

by

the Exception class.

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
{

//Some Code that may expected to raise an exception

}
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

Dr. K.V.G Rao


Prof & HOD CSE
30

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Whatever happens inside the try block, it is guaranteed that finally block gets executed. Hence,
all resource releases should be in the finally block.
try
{
}
catch
{
}
finally
{
}

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
31

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


PROGRAM WITHOUT HANDLING THE ERROR:
Module module1
Sub main()
Dim n1,n2,res As Integer
Console.WriteLine(enter any 2 numbers)
n1=Console.ReadLine
n2= Console.ReadLine
res=n1/n2
Console.WriteLine(res:&res)
Console.ReadLine()
End sub
End Module

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

Dr. K.V.G Rao


Prof & HOD CSE
32

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

PROGRAM FOR HANDLING THE EXCEPTION:


Module exceptiondemo
Sub main()
Dim n1,n2,res As Integer
Try
Console.WriteLine(enter any 2 numbers)
n1=Console.ReadLine
n2=Console.ReadLine
res=n1/n2
Console.WriteLine(res:&res)
Catch e As Arithmetic exception
Console.WriteLine(divide by zero is not possible)
Catch e1 As ArrayTypeMismatch Exception
Console.WriteLine(datatype mismatch)

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
33

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Catch ex As Exception
Console.WriteLine(ex.message)
Finally
Console.WriteLine(It is finally block)
End try
Console.ReadLine()
End sub
End Module

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

Dr. K.V.G Rao


Prof & HOD CSE
34

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

Title: Web Service

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

Dr. K.V.G Rao


Prof & HOD CSE
35

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Advantages of Web Service:
Web Service messages are formatted as XML, a standard way for communication between two
incompatible system. And this message is sent via HTTP, so that they can reach to any machine
on the internet without being blocked by firewall.
Examples for Web Service:
Weather Reporting: You can use Weather Reporting web service to display weather information
in your personal website.
Stock Quote: You can display latest update of Share market with Stock Quote on your web site.
News Headline: You can display latest news update by using News Headline Web Service in
your website.

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

Dr. K.V.G Rao


Prof & HOD CSE
36

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


End Function
b) (i) Right click in solution explorer => Add Web Reference=> Select browser to
option as Web Services in this solution.It will display the number of web services in
the solution.
(ii) Select the web service you want to use.
(iii) It will display all the methods.
(iv) Select the method you want to use and Click Invoke button to see the xml
message returned by the method.
c) Give the web reference name (by default localhost) and click Add Reference
button.
d) Web reference with name local host gets created in App_WebReferences folder.
e) Check if files with extensions .disco and .wsdl gets generated in localhost.
4. In code file (Default.aspx.vb):
a. Import the namespace System.Web.Services.
b. Create an object of web service.(i.e myWebService)
c. Use the methods of respective web service.
5. Click the Build menu in application => select Build web site.
If Build succeeded message comes in status bar.
Execute the application and view the results
Else
Find out the errors and solve the errors.
End if

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
37

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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

Dr. K.V.G Rao


Prof & HOD CSE
38

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class myWebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
<WebMethod()> _
Public Function myFunction() As String
Return "This is myFunction in Webservice"
End Function
End Class

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

Dr. K.V.G Rao


Prof & HOD CSE
39

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations

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.

2. What are the different validators in ASP.NET?


Ans:
1. Required field Validator
2. Range Validator
3. Compare Validator
Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
40

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


4. Custom Validator
5. Regular expression Validator
6. Summary Validator

3. Which protocol is used to call a Web service?


Ans: HTTP Protocol

4. Can we have multiple web config files for an asp.net application?


Ans: Yes.

5. 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.

6. How can we apply Themes to an asp.net application?


Ans: We can specify the theme in web.config file. Below is the code example to apply theme:

<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

Dr. K.V.G Rao


Prof & HOD CSE
41

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


</system.web>
</configuration>

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.

8. Explain the working of passport authentication.


Ans: First of all it checks passport authentication cookie. If the cookie is not available then the
application redirects the user to Passport Sign on page. Passport service authenticates the user
details on sign on page and if valid then stores the authenticated cookie on client machine and
then redirect the user to requested page.

9. What are the asp.net Security Controls?


Ans:

<asp:Login>: Provides a standard login capability that allows the users to enter their
credentials

<asp:LoginName>: Allows you to display the name of the logged-in user

<asp:LoginStatus>: Displays whether the user is authenticated or not

<asp:LoginView>: Provides various login views depending on the selected template

<asp:PasswordRecovery>: email the users their lost password

10. what is boxing and unboxing?

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
42

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Ans: Boxing is assigning a value type to reference type variable. Unboxing is reverse of boxing
ie. Assigning reference type variable to value type variable.

11. Differentiate strong typing and weak typing.


Ans: In strong typing, the data types of variable are checked at compile time. On the other hand,
in case of weak typing the variable data types are checked at runtime. In case of strong typing,
there is no chance of compilation error. Scripts use weak typing and hence issues arises at
runtime.

12. How we can force all the validation controls to run?


Ans: The Page.Validate() method is used to force all the validation controls to run and to
perform validation.

13. List the major built-in objects in ASP.NET?


Ans:

Application
Request

Response

Server

Session

Context

Trace

14. What are the different types of cookies in ASP.NET?

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
43

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Ans: Session Cookie Resides on the client machine for a single session until the user does not
log out.
Persistent Cookie Resides on a users machine for a period specified for its expiry, such as 10
days, one month, and never.

15. What is the file extension of web service?


Ans: Web services have file extension .asmx..

16. What are the components of ADO.NET?


Ans:

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

Dr. K.V.G Rao


Prof & HOD CSE
44

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


Out-of-Process Session state management stores data in an external server. The external server
may be either a SQL Server or a State Server. All objects stored in session are required to be
serializable for Out-of-Process state management.

18. What are the different types of caching?


Ans: ASP.NET has 3 kinds of caching :
1. Output Caching,
2. Fragment Caching,
3. Data Caching.

19. Write code to send e-mail from an ASP.NET application?


Ans:

1 MailMessage mailMess = new MailMessage ();


2 mailMess.From = "abc@gmail.com";
3 mailMess.To = "xyz@gmail.com";
4 mailMess.Subject = "Test email";
5 mailMess.Body = "Hi This is a test mail.";
6 SmtpMail.SmtpServer = "localhost";
7 SmtpMail.Send (mailMess);

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
45

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


MailMessage and SmtpMail are classes defined System.Web.Mail namespace.

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.

21. What are the advantages of Passport authentication?


Ans:

All the websites can be accessed using single login credentials. So no need to remember
login credentials for each web site.

Users can maintain his/ her information in a single location.

22. In which event are the controls fully loaded?


Ans: Page load event.

23. Which data type does the RangeValidator control support?


Ans: The data types supported by the RangeValidator control are Integer, Double, String,
Currency, and Date.

24. Which namespaces are necessary to create a localized application?


Ans: System.Globalization

25. Differentiate between Client-side and server-side validations in Web

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
46

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


pages?
Ans:

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.

Server-side validations occurs place at the server side.

26. Authentication and authorization?


Ans:

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.

Authentication is required before authorization.

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.

27. What are Web server controls in ASP.NET?

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

Dr. K.V.G Rao


Prof & HOD CSE
47

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


28. Explain serialization and deserialization.
Ans: Serialization is the process of converting an object into a stream of bytes.
Deserialization is the process of creating an object from a stream of bytes.
Both these processes are usually used to transport objects.

29. Explain how a web application works.


Ans: A web application resides in the server and serves the client's requests over internet. The
client access the web page using browser from his machine. When a client makes a request, it
receives the result in the form of HTML which are interpreted and displayed by the browser.
A web application on the server side runs under the management of Microsoft Internet
Information Services (IIS). IIS passes the request received from client to the application. The
application returns the requested result in the form of HTML to IIS, which in turn, sends the
result to the client.

30. Explain the different parts that constitute ASP.NET application.


Ans: Content, program logic and configuration file constitute an ASP.NET application.

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

Dr. K.V.G Rao


Prof & HOD CSE
48

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


31. How do you open a page in a new window?
Ans: To open a page in a new window, you have to use client script using
onclick="window.open()" attribute of HTML control.

32. What are the differences between Abstract and interface?


Ans:

Abstract cannot be instantiated but we can inherit. Interface it cannot be inherit it can be
instantiate.

Interface contain only declarations no definitions. Abstract contain declarations and


definitions.

The class which contains only abstract methods is interface class.

A class which contains abstract method is called abstract class.

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.

33. What are differences between function and stored procedure?


Ans:

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

Dr. K.V.G Rao


Prof & HOD CSE
49

G. NARAYANAMMA INSTITUTE OF TECHNOLOGY & SCIENCE


(For Women)
Autonomous of JNTUH
Shaikpet, Hyderabad.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

IV/IV B.Tech I Semester G-12 Regulations


function.

Prepared by

Approved by

Mrs. M. Lalitha,Asst.Prof.,CSE
Mr. T. Rajesh, Asst.Prof.,CSE
Mrs. D. Naga Swetha, Asst.Prof.,CSE

Dr. K.V.G Rao


Prof & HOD CSE
50

Anda mungkin juga menyukai