Unity University Department of Computer Science Windows Programming-Assignment I

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Unity University

Department of Computer Science

Windows Programming-Assignment I

Short answer

1 declare an array of ten single precision data type (use both method )

_____________________________________________________________

2 a) how many elements are there in the following array declaration

Dim fine (10) As short

___________________________________________________

b) what is the index for the last element for the above declaration

_____________________________________________

3 if you declare an array at the top of the form , you can use it throughout the form ( say true or false )
__________________________

4 a) what do you understand when an array is declared like the following

Dim kk( ) As single

_______________________________________________________________

b) if we want the dimension for the above array to be changed(set)to the size of 10 . what vb.net
statement that we should write .

_________________________________

C)use for loop statement and assign a value 6 to each element of array in part b above

____________________________

_____________________________

______________________________

______________________________

D) What does the following statement refer TO PART b above ? Ķ

Ubound(kk)
___________________________________________ķ

5 consider the following segment of code is written under the click event procedure of BUTTUN 1 .
Predict output in the listbox . When the button is clicked

Dim gg() AS single= { 23, 11,56,49, 34}

Array.sort(gg)

Dim i AS short

For i=0 to Ubound (kk)

LstList.item.add(gg )

Next

_________________

Programming excercise

Exercise on array to be submitted on _______________________________________

1. Write a vb.net program that find the median value for a given list of numbers
● When “enter data” button is clicked, then the program immediately request how many
Numbers are in the list. Then it stores all numbers in the list in an array using input function
● When “median “ button is clicked ,then the program display all the numbers in the list
followed by the median value as follow
Sample data for even number of element

Sample data for odd number of element


Note: median is the middle value for an array data
The program arrange the original data in ascending order , as we can see above .
Use the example format given in the example in your reference materials

2. Write a program that find the standard deviation temperature for a given number of days.
● Temperatures for the number of days are accepted using inputbox function . after accepting
the number of days for the calculation (use dynamic array to store the temperatures for the
number of days)
● Finally, an output will be displayed using textbox like we see on the example in the array
● Standard deviation for set of data is calculated
● To enter data using inputbox, then click enter temperatures button
● When display temperatures button is clicked , then the output is displayed as follow.

Sample data

You might also like