

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Class: Application Programming for Information Systems; Subject: Information Studies; University: Syracuse University; Term: Fall 2008;
Typology: Lab Reports
1 / 2
This page cannot be seen from the preview
Don't miss anything!


1a. Write the piece of code that would declare a two-dimensional array of strings with 9 rows and 15 columns.
1b. Write the piece of code that would assign an empty string to each element of the two- dimensional array declared in the previous question. Use two nested For loops; you do not have to show the declarations of the index variables.
Private Structure personrecord Dim name as String Dim age as Integer End Structure
Dim persons ( 0 to 11 ) as personrecord
Assume that all 12 elements of the array have already been defined (by reading from a file, for example). Write the code that would compute the average of all the values in the age field in the array.
Suppose that this program also has a version of the bubble sort that uses the above procedure to swap the array elements. Dim i, j as Integer
For i = 0 To 3 // if array has n elements, number of passes is n- For j = 0 To (3 – i) // number of comparisons If numbers(j) > numbers (j + 1) Then Call swap (numbers (j), numbers (j+1)) End If Next Next
Show the order of these array elements after the first, second and third passes of the bubble sort algorithm.
Initial value After 1st^ pass (i=0)
After 2nd^ pass (i=1)
After 3rd^ pass (i=2) numbers(0) numbers(1) numbers(2) numbers(3) numbers(4)