You are on page 1of 4

Question 1- Design a form based applications using labels, text boxes, and buttons to perform basic arithmetic operations

on integers

Control Label1 Label2 Label3 Textbox1 Textbox2 Textbox3 Command1 Command2 Set The Properties: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Command5 Private Sub Cmdadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdadd.Click TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text) End Sub Command3 Command4

Property Caption: First No. Caption: Second No. Caption: Result. Text: (empty) Text: (empty) Text: (empty) Caption: Add Name: Cmdadd Caption: SUB Name: Cmdsub Caption: MUL Name: Cmdmul Caption: DIV Name: Cmddiv Caption: EXIT Name: CmdEX

Private Sub Cmdsub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdsub.Click TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text) End Sub Private Sub Cmdmul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdmul.Click TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text) End Sub Private Sub Cmddiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmddiv.Click TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text) End Sub Private Sub Cmdex_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdex.Click End End Sub End Class

Question 2- Describe the concept of Exceptions in .Net environment


NET implements a systemwide, comprehensive approach to exception handling. As noted in the chapter introduction, instead of an error number, there is an exception object. This object contains information relevant to the error, exposed as properties of the object. Later youll see a summary of the properties and the information they expose in a table. Such an object is an instance of a class that derives from a class named System.Exception. As shown later, a variety of subclasses of System.Exception are used for different circumstances. Important Properties and Methods of an Exception . The Exception class has properties that contain useful information about the exception, as shown in the following table:

Property HelpLink InnerException Message Source StackTrace

Description A string indicating the link to help for this exception Returns the exception object reference to an inner (nested) exception A string that contains a description of the error, suitable for displaying to users A string containing the name of an object that generated the error A read-only property that holds the stack trace as a text string. The stack trace is a list of the pending method calls at the point at which the exception was detected. That is, if MethodA called MethodB, and an exception occurred in MethodB, the stack trace would contain both MethodA and MethodB. A read-only string property that holds the method that threw the exception

TargetSite

The two most important methods of the Exception class are as follows:

Method GetBaseException ToString

Description Returns the first exception in the chain Returns the error string, which might include as much information as the error message, the inner exceptions, and the stack trace, depending on the error

Question 3- Write a simple XML file for student details (sname, sno, sbranch, saddr).
college.xml <college> <student> <student branch=CSE> <sname firstname=h>Rama</sname> <sno>1</sno> <saddr>Hyderabad</saddr>

</student> <student> <student branch=ECE> <sname firstname=r>sita</sname> <sno>1</sno> <saddr>Delhi</saddr>

</student> <student> <student branch=EEE> <sname firstname=p>Rani</sname> <sno>1</sno> <saddr>Puna</saddr>

</student> </college> The root element in the example is <college>. All <student> elements in the document are contained within <college>. The <student> element has 4 children: <sname>, < sno>, <sbranch>, <saddr>.

Question 4- What is meant by DTD? What are the building blocks of DTD?
DTD is one of the specifications included in to XML. DTD has its own small set of constructs and grammar rules that helps us to prepare our markup language specifications. That is the constructs of DTD are understood by the XML parsers that can help our markup language implementation application. DTD file contains the building blocks (i.e. tags) of an XML file. The building blocks of XML document are: 1. Elements (Tags) 2. Attributes 3. Entities 4. PCDATA 5. CDATA

Question 5- Write a program that uses the nodeValue property to change the text node of the first <sname> element in "college.xml.
<html> <head> <script type="text/javascript" src="loadxmldoc.js"> </script> </head> <body> <script type="text/javascript"> xmlDoc=loadXMLDoc("college.xml"); x=xmlDoc.getElementsByTagName("sname")[0]; document. write (xmlDoc.documentElement.nodeName); document. write ("<br />"); document.write(xmlDoc.documentElement.nodeType); </script> </body> </html>

You might also like