In Exercises 2 through 6, determine the output displayed when the button is clic
ID: 3705576 • Letter: I
Question
In Exercises 2 through 6, determine the output displayed when the button is clicked on 2. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim num As Integer - 3 Do Loop Until num > 15 txtoutput.Text-CStr (num) End Sub 4. Private Sub btnDisplay_Click(... Handles btnDisplay.Click Dim total As Double0 Dim num As Integer -1 Do total +num num += 1 Loop Until num >= 5 txtoutput.Text CStr (total) End Sub 6. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim numTries As Integer 0 Dim Yr As Integer Dim msg As String -"In what year did the Beatles invade the U.S.?" Do numTries += 1 yr-Cint (InputBox (msg, "Try #" & numTries)) Select Case yr Case 1964 MessageBox. Show ("They appeared on the Ed Sullivan shown in "& "February 1964." & You answered the question "& "correctly in " & numTries & tries.", "Correct") Case Is 1964 MessageBox. Show ("Earlier than "& yr & ".") End Select Loop Until (yr - 1964) Or (numTries-7) If yr 1964 Then MessageBox. Show ("Your 7 tries are up, the answer is 1964.","Sorry") End I1f End Sub Assume that the responses are 1950, 1970, and 1964)Explanation / Answer
2. Output:
24
In the while loop num = 2*3 = 6 < 15, num = 2*6 = 12<15, num = 2*12 = 24 > 15 so loop ends. The last value of num = 24
4 Output:
10.0
total = 1.0 num = 1
total = 3.0 num = 2
total = 6.0 num = 3
total = 10.0 num = 4
loop will execute until num >= 5
6.
Output:
In what year did the Beatles invade the U.S. ? 1950
Later than 1950.
In what year did the Beatles invade the U.S. ? 1970
Earlier than 1950.
In what year did the Beatles invade the U.S. ? 1964
They appeared on the Ed sullivan shown in February 1964. You answered the question correctly in 3 tries. Correct
Do ask if any doubt. Please upvote.
Later than 1950.