Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

determine the output displayed when the button is clicked. 1. Private Sub btnDis

ID: 3598669 • Letter: D

Question

determine the output displayed when the button is clicked.

1. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim nums() As Integer = {5, 7, 2, 3} Dim numQuery = From num In nums
Where num > 4
Select num For Each num As Integer In numQuery
lstOutput.Items.Add(num) Next
End Sub

3. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim line As String = "I'm going to make him an offer he can't refuse" Dim words() As String = line.Split(" "c) Dim wordQuery = From word In words
Where word.Length = 5
Select word lstOutput.DataSource = wordQuery.ToList
lstOutput.SelectedItem = Nothing End Sub

Explanation / Answer

Question 1:

Output: no output but it transfer the data to another array

Dim nums() As Integer = {5, 7, 2, 3} // create array of integer with values 5,7,2,3

Dim numQuery = From num In nums // create a query and adds up the value of array which are greater then 4
Where num > 4 Select num

For Each num As Integer In numQuery // add the numQuery number to istOutput

lstOutput.Items.Add(num) Next

End Sub

last istOutput has { 5 , 7 }

Question 3:

Output: no output but it transfer the data to another array

Dim line As String = "I'm going to make him an offer he can't refuse"  // Create a string line

Dim words() As String = line.Split(" "c) // split the string by space ' '

Dim wordQuery = From word In words // find the strings which having length equal to 5

Where word.Length = 5

Select word

lstOutput.DataSource = wordQuery.ToList
lstOutput.SelectedItem = Nothing End Sub

IstOutput is have { 'going ','offer','can't' }