Académique Documents
Professionnel Documents
Culture Documents
SULUR
UNIT I
1. Print the output for the following expression using arithmetic rules:
4*(80/4) +50-38+3^3-(4*50)
STEP 1 : 3^3 =27
STEP 2 : 80/4=20
STEP 3 : 4*50 = 200
STEP 4: 4*20 =80
STEP 5 : 80 +50-38+27-200
STEP 6 : 130-38+27-200
STEP 7 : 92+27-200
STEP 8 : 119-200
STEP 9 :-81
Toolbox Window
The Toolbox window contains all the controls you can use to build your applications interface.
This window is usually retracted, and you must move the pointer over it to view the Toolbox.
The controls in the Toolbox are organized in various tabs, so take a look at them to become
familiar with the controls and their functions.
The Common Controls tab contains the icons of the most common Windows controls. The Data
tab contains the icons of the objects you will use to build data-driven applications (theyre
explored later in this tutorial). The Dialogs tab contains controls for implementing the common
dialog controls, which are so common in Windows interfaces; theyre discussed in Chapter,
More Windows Controls.
Solution Explorer Window
The Solution Explorer window contains a list of the items in the current solution. A solution can
contain multiple projects, and each project can contain multiple items. The Solution Explorer
displays a hierarchical list of all the components, organized by project. You can right-click any
component of the project and choose Properties in the context menu to see the selected
components properties in the Properties window. If you select a project, you will see the Project
Properties dialog box.
Properties Window
This window (also known as the Properties Browser) displays all the properties of the selected
component and its settings. Every time you place a control on a form, you switch to this window
to adjust the appearance of the control. You have already seen how to manipulate the properties
of a control through the Properties window.
Many properties are set to a single value, such as a number or a string. If the possible settings of
a property are relatively few, theyre displayed as meaningful constants in a drop-down list.
Other properties are set through a more elaborate interface. Color properties, for example, are set
from within a Color dialog box thats displayed right in the Properties window. Font properties
are set through the usual Font dialog box. Collections are set in a Collection Editor dialog box, in
which you can enter one string for each item of the collection, as you did for the items of the
Combo Box control earlier in this chapter.
3. Develop a vb.net program for the following output using dialog box:
Module mod DISPLAYMSG
Sub main ()
End sub
4. Draw and explain the Tool bar Commands that required to build an application.
TextBox
It enables the user to select a single option from a group of choices when paired with other
RadioButton controls.
Checkbox
5. Construct the truth table for AND & OR logical operators in vb.Net.
AND gate
The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are
high. A dot (.) is used to show the AND operation i.e. A.B. Bear in mind that this dot is
sometimes omitted i.e. AB
OR gate
The OR gate is an electronic circuit that gives a high output (1) if one or more of its
inputs are high. A plus (+) is used to show the OR operation.
SECTION C
Sub Main ()
Dim c As Integer = 5
Dim d As Integer = 20
If (a And b) Then
End If
If (a Or b) Then
End If
If (a Xor b) Then
End If
If (c And d) Then
End If
If (c Or d) Then
End If
If (c Or d) Then
Console.WriteLine("Line 6 - Condition is true")
End If
If (a AndAlso b) Then
End If
If (a OrElse b) Then
End If
a = False
b = True
If (a And b) Then
Else
End If
End If
Console.ReadLine()
End Sub
End Module
2. Develop a program using relational operator for the following condition, a value is 21 ,
b value is 10.
ANSWER:
Dim a as integer=21
If(a=b) then
Console.writeline(a is eqal to b)
Else
End if
If(a<b) then
End if
If(a>b) hen
Else
End if
If(a<=b) then
End if
If (a>=b) then
5. Write the coding for the following output using arithmetic operator:
Public Function Main() As Integer
Dim BMI as Integer
Dim Height, weight As Double
Height = text1.text
Weight = text2.text
End Function
UNIT II
SECTION - B
a)sub general()
Subgeneral 2()
End sub
End sub
Result x+y
End function
c) Subproduct ()
Dim as integer =6
Dim b as integer=5
return result
end sub
if value= then
return 0
else
value.sum(value-1)
end if
end function
Answer
a)sub general ()
end sub
end sub
return x+y
end function
c)sub producet()
dim a as integer=6
dim b as integer =5
end sub
if value = 0 then
return 0
else
end if
end function
2. Build a program to find the square values of the integer from 1-10 using function
procedure.
ANSWER:
module mod squre
sub main()
dim I as integer
console. Write line (numbers $vb tab $square)
for i=1 to 10
console.write line (I $vb tab$ square (i))
next
end sub
function. square(by val y as integer )as integer
retry y^2
end function
end module
output
number squre
1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81
10 100
3. Develop a program using vb.net for the following output.
Element value
0 19
1 13
2 15
3 7
4 11
5 9
6 13
7 5
8 17
9 1
ANSWER:
sub main()
output&=i&ubtabe value
output &=i&ubtab&array(i)
next
end sub
end module
Answer:
Passing parameter by value, when a method is called a storage location is created for each
value parameter.
In passing parameter by reference, when you pass parameter, a new storage location is
created for the parameter.
In passing parameter by value, the changes made to the parameter inside the method have
no effect on the argument.
In passing parameter by reference, the changes made to the parameter inside the method
have should effect on the argument.
5. IF ONE() ARRAY CONTAIN THREE VALUES ARE 1,2,4 AND TWO() ARRAY
HAVE THREE VALUES ARE 4,5,6. Using jagged array how to merge the one() and
two() arrays.
Answer :
Module Module1
Sub Main()
Dim one() As Integer = {1, 2, 3}
Dim two() As Integer = {3, 4, 5, 6, 7}
Dim jag()() As Integer = {one, two}
Dim i, j As Integer
For i = 0 To jag.Length - 1
For j = 0 To jag(i).Length - 1
Console.Write((jag(i)(j)))
Next
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Result:
123
34567
SECTION-C
c) Procedure instruction which dose not task any argument and ose not return a value
ANSWER:
a) Function hypendence (by val side 1.as double side 2.as double)as double
c) sub instruction ()
a)X=Math. Abs(7.5)
ANSWER:
a)x=8
b)x=7
c)x=0
d)x=6
3. Construct a program for sums for the values contained in 10 elements integer array.
ANSWER:
sub main()
I as integer =0
total +=array(I)
end sub
end module
output
4. Create a program for the following output using passing parameter by reference
ANSWER:
End Module
6. Construct a program for the following output using passing parameter by value,
SECTION-B
1. Construct the program display the color display box when a user clicks the command button as
the following constraints.
g.draw line(pen,240,30,260,120)
3. Develop a program using multimedia to display two images when you click the button
(command).
ANSWER:
dim I as integer
for i=0 to 1
next
1.getcell ascent
2. getcelldescent
3. getEmHeight
4.getlinespacing
Eg:
Graphicsobject. Drawstring
(ascent:&family.getlinespacing(fontstyle.regular),arial,brush,10,90)
Answer:
SECTION C
ANSWER:
g.rectangle(brush 90,30,150,120)
g.draw line(pen,120,30,140,40)
g.rectangle(brush 90,150,30,120)
g.draw line(pen,90,40,120,140)
g.draw l;ine(pen,120,150,30,80)
g.draw line(pen,150,40,20,125)
g.rectangle(pen,180,110,100,80)
g.draw line(pen,150,40,20,125)
g.rectangle(pen,180,11,100,80)(color)
ANSWER:
rectangle.location=new point(100,35)
rectangle.location=new point(180,165)
3. Create a program for set the following font properties in font dialog box.
style=font style-regular
dim times new roman as font =new font (times new roman)
style=font style.regular
dim times new roman as font =new font(tims new roman 12.style)
dim g as graphics:point event graphics
g.draw line(pen,240,30,260,120)
End Sub
5. create a program for the following output using draw polygon method,
Answer :
End Sub
UNIT IV
SECTION - B
1. Create a program using Files Stream Class for the following output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -1
ANSWER:
Module fileProg
SubMain()
Dim f1 AsFileStream=NewFileStream("test.dat", _
FileMode.OpenOrCreate,FileAccess.ReadWrite)
Dim i AsInteger
For i =0To20
f1.WriteByte(CByte(i))
Next i
f1.Position=0
For i =0To20
Next i
f1.Close()
Console.ReadKey()
EndSub
EndModule
2. Develop a vb.net program using create directory method.
ANSWER:
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
End Sub
End Module
DATABASE
FILE
RECORD
FIELD
BYTE
BIT
BIT:
BYTE:
RECORD:
Collection of fields
FILE:
Collection of records
Answer:
1. Console. Out
2. Console. in
3. Console. Error
1.console .out:
Returns the standard output stream object,which enables a program to output data to the
screen.
2. console .in:
Returns the standard input stream object, which enables a program to input data from the
keyboard.
3.Console. Error:
Returns the standard error stream object , which enables a program to output error
message to the screen.
a) Delete a directory
ANSWER:
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
'If directory does not exist, don't even try
If Directory.Exists(root) Then
Directory.Delete(root)
End If
End Sub
End Module
b) get directories
ANSWER:
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
' Create sub directory
If Not Directory.Exists(subdir) Then
Directory.CreateDirectory(subdir)
End If
End Sub
End Module
Section C
ANSWER:
a. create a fie:
Dim filename as string
Filename = txtinput.text
If file.exits (filename) then
Textoutput.text=getinformation (filename).
b. Create a directory:
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
End Sub
End Module
c. get creation time of file:
Module Module1
Sub Main()
' Get and set file creation time
Dim fileName As String = "c:\Temp\Mahesh.txt"
File.SetCreationTime(fileName, DateTime.Now)
Dim dt As DateTime = File.GetCreationTime(fileName)
Console.WriteLine("File created time: {0}", dt.ToString())
Console.ReadLine()
End Sub
End Module
d. get last access time of file
Module Module1
Sub Main()
' Get and set file last access time
Dim fileName As String = "c:\temp\Mahesh.txt"
File.SetLastAccessTime(fileName, DateTime.Now)
Dim dt As DateTime = File.GetLastAccessTime(fileName)
Console.WriteLine("File last access time: {0}", dt.ToString())
Console.ReadLine()
End Sub
End Module
e. get last written time of file
Module Module1
Sub Main()
' Get and set file last access time
Dim fileName As String = "c:\temp\Mahesh.txt"
File.GetLastWriteTime(fileName, DateTime.Now)
Dim dt As DateTime = File. GetLastWriteTime(fileName)
Console.WriteLine("GetLastWriteTime: {0}", dt.ToString())
Console.ReadLine()
End Sub
End Module
2. Develop a program for following the output using reading data from a sequential access file.
ACCOUNT
FIRST NAME
LAST NAME
BALANCE
OPEN FILE
ANSWER:
Filename=filechooser.filename
ANSWER:
a. Create a Directory
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
End Sub
End Module
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
' Create sub directory
If Not Directory.Exists(subdir) Then
Directory.CreateDirectory(subdir)
End If
End Sub
End Module
c. Delete a directory
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
'If directory does not exist, don't even try
If Directory.Exists(root) Then
Directory.Delete(root)
End If
End Sub
End Module
Answer :
The smallest data item are called bits. Each data item or bit can assume either the value 0
or 1.
Decimal digits (0,1,2,3,4,5,6,7,8,9), letters (A to Z, a to z), special symbols (@,$,%,*,(,)).
Digits, letters and special symbols are referred to as character.
Composed of characters are fields.
A field is a group of characters that convey some meaning.
Composed of several fields are called record.
Group of relate records are called file.
Example:
File
Arun Bcomca
Kumar Bca
Record
Arun bcomca
Arun field
01001010 Byte
1 bit
5. Construct a program for how to access the random access file.
'UserToAdd values
With UserToAdd
.UserID = Val(txt_UserID.Text)
.UserBarcode = txt_UserBarcode.Text
.Forename = txt_Forename.Text
.Surname = txt_Surname.Text
.AccessRights = cmb_AccessRights.Text
End With
UserFile = FreeFile()
RecordNumber = Len(UserFile) + 1
FileClose(UserFile)
UNIT V
SECTION B
a) Update authors
SET lastname = jones
b) Update authors
SET firstname = david
Module Module1
Sub Main()
Using reader As XmlReader =XmlReader.Create("C:\perls.xml")
While reader.Read(
If reader.IsStartElement() Then
End If
End While
End Using
End Sub
End Module
Answer :
using System.Xml
writer.WriteStartElement("items");
writer.WriteEndElement();
writer.Close();
}}
Sql> create a table class ( sno number(2), regno varchar2 ( 20), name varchar2 (10));
Sql> table created.
Sql> insert into class values (1,1u13ba001,ajith);
Sql> 1 row created.
Sql> insert into class values (2,1u13ba002,arun);
Sql> 1 row created.
Sql> insert into class values (3,1u13ba003,babu);
Sql> 1 row created.
Sql> select * from class;
Sql> sno regno name
1 1u13ba001 ajith
2 1u13ba001 arun
3 1u13ba001 babu
Sql> delete from class where name=arun;
5. Draw and explain about system architecture in asp.net.
Answer:
o Application layer is the form where we design using the controls like textbox,
labels, command buttons etc.
o Business layer is the class where we write the functions which get the data from
the application layer and passes through the data access layer.
o Data layer is also the class which gets the data from the business layer and
sends it to the database or gets the data from the database and sends it to the
business layer.
SECTION-C
QUERIES:
|1|Ramesh|32|Ahmedabad|2000.00|
|2|Khilan|25|Delhi|1500.00|
|4|Chaitali|25|Mumbai|6500.00|
|5|Hardik|27|Bhopal|8500.00|
|6|Komal|22| MP |4500.00|
|7|Muffy|24|Indore|10000.0
| ID | NAME | SALARY |
1|Ramesh|2000.00|
|2|Khilan|1500.00|
|4|Chaitali|6500.00|
|5|Hardik|8500.00|
|6|Komal|4500.00|
|7|Muffy|10000.00|
+----+----------+----------+
If you want to fetch all the fields of CUSTOMERS table, then use the following query:
+----+----------+-----+-----------+----------+
+----+----------+-----+-----------+----------+
|1|Ramesh|32|Ahmedabad|2000.00|
|2|Khilan|25|Delhi|1500.00|
|4|Chaitali|25|Mumbai|6500.00|
|5|Hardik|27|Bhopal|8500.00|
|6|Komal|22| MP |4500.00|
|7|Muffy|24|Indore|10000.00|
Data provider:
A data provider is used for connecting to a database , executing commands and retrieving data
and storing it in a dataset.
Connection:
Command:
A command is a sql statement or a stored procedure.
Data reader:
Data adapter:
Data set:
SQL> CREATE TABLE STUDENT (SNAME VARCHAR2 (20), CLASS VARCHAR2 (10),
MARK NUMBER(3), TOTAL NUMBER(3));
SQL>TABLE CREATED.
OUTPUT: