Select Case intLevel Case 1, 2 strStatus = "Bronze" Case 3 To 5 strStatus = "silver" Case 6, 7 strStatus = "Gold" Case Else strStatus "Platinum" End Select
What will the code in Figure 4-55 assign to the strStatus variable when the intLevel
variable contains the number 7?
a. Bronze
b. Gold
c. Platinum
d. Silver
To know the assigned value to the variable named strStatus when the variable named intLevel is initialized with the number 7.
The given code is:
Select Case intLevel
Case 1, 2
strStatus = "Bronze"
Case 3 To 5
strStatus = "Silver"
Case 6, 7
strStatus = "Gold"
Case Else
strStatus = "Platinum"
End Select
In the above code,
The Select Case statement contains a variable named intLevel.
The first Case is executed for the value 1 and 2 of the variable named intLevel.
This Case assigns the code "Bronze" to the variable named strStatus.
The second Case is executed for the value 3 to 5 of the variable named intLevel.
This Case assigns the code "Silver" to the variable named strStatus.
The third Case is executed for the value 6 and 7 of the variable named intLevel.
This Case assigns the code "Gold" to the variable named strStatus.
The fourth Case is executed for the other values of the variable named intLevel.
This Case assigns the code "Platinum" to the variable named strStatus.
Step by step
Solved in 4 steps