Basic Programming Name -
Bit-String Flicking Calculator Worksheet #2
Deskcheck the program below and answer the questions that appear on lined paper.
Show your deskchecking (a column with intermediate values for each variable and
object including J, txtBitString1, and lblAnswer) in the area to the right of the
program.
Option Explicit
Private Sub cmdCalculate_Click()
Dim J As Integer ' loop variable
txtBitString1.Text = "10110"
For J = 1 To Len(txtBitString1)
If Mid$(txtBitString1, J, 1) = "1" Then
lblAnswer = lblAnswer & "O"
Else
lblAnswer = lblAnswer & "1"
End If
Next J
End Sub
'Question #1 - How many loop iterations occur with the For loop above?
'Question #2 - What is the value of Mid$(txtBitString1, 3, 1)?
'Question #3 - What is the value of Mid$(txtBitString1, Len(txtBitString1), 1)?
'Question #4 - What is the value of lblAnswer after 3 loop iterations?
'Question #5 - What is the final value of lblAnswer?
'Question #6 - What is the value of (Mid$(txtBitString1, 3, 1) = "1")? (True or False)
'Question #7 - What is the value of (Mid$(txtBitString1, Len(txtBitString1) - 4, 1) = "1")? (True or False)