
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
Instructions for a lab exercise in vb.net focused on understanding a two-dimensional array. Students are required to write an expression to access a specific element, analyze a code snippet that calculates the sum of array elements, and determine the output of the code during the first iteration.
Typology: Lab Reports
1 / 1
This page cannot be seen from the preview
Don't miss anything!

1. Understanding a Two-dimensional Array Program
Suppose that we have a two-dimensional array that was read in from the file “samples.txt”, as shown in class. Shown here is the declaration of the array and how it would look:
Dim numbers(0 To 5, 0 To 2) As Integer numbers Column 0 Column 1 Column 2 Row 0 15 3 - Row 1 25 6 99 Row 2 35 -20 17 Row 3 45 10 3 Row 4 55 22 4 Row 5 65 -9 11
a. Write an expression that will give the array element in Row 2, Column 1:
What is the value of this element?
b. Here is a code fragment that shows a nested loop that iterates over every element of the array. Dim total as Integer Label1.Text = “ “ For row = 0 to 5 total = 0 For col = 0 to 2 total = total + numbers(row,col) Next Label1.Text = Label1.Text & “Sum over “ & row &”= “ & total & vbCrLf Next
Given the values in the numbers array, what will the value of Label1.Text be during the first iteration of the outermost loop, when row = 0?
What are the remaining values given in the Label?