

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Written Homework 2 02/14/2008 Due: 02/21/
Chapter 4 Procedures and Functions
Chapter 5 Decision Making (If Blocks)
5. What will be the output of the following code?
Dim maxNum As Double = 100 Dim numPresent As Double = 105
If numPresent > maxNum Then txtDisplay.Text = “Fire Code Violation, kick” & (maxNum-numPresent) & “People out!” Else txtDisplay.Text = “OK” End If
Chapter 6 Loops (Going in circles)
6. What will be the output in the ListBox (lstDisplay) after the following code has been executed
Dim startPoint As Integer = 1
Dim endPoint As Integer = 10
Dim counter As Integer
For counter = startPoint to endPoint step 2
lstDisplay.Items.Add(2 &”x”& counter &” = ”& 2*counter)
Next
Chapter 3.4 Strings
7. Consider the following code; what will be the value of the string variable strVar after the code is executed?
Dim strVar As String Dim str1 As String = “Visual Basic is very easy” strVar = str1.SubString(7,5) & “ “ & str1.SubString(13,2) &” “& str1.SubString(21,4)