ExamVeda
Login
Home
This question belongs to Computer Science Visual Basic
Visual Basic
?

In the following Visual Basic code, what will be in msg, if str contains "visual basic"?

Dim str as String
Dim  msg as String
If str.toUpper="VISUAL BASIC" 
   msg="VB.Net"
Else
   msg="Not Visual Basic"
EndIf

Answer & Solution
Correct Answer: Option A
The given Visual Basic code snippet compares the string variable str with "VISUAL BASIC" after converting it to uppercase using the ToUpper method. If the str variable contains "visual basic", it will be converted to "VISUAL BASIC" and compared with "VISUAL BASIC". Since the comparison is case insensitive due to the use of ToUpper, the condition will be true and msg will be assigned the value "VB.Net". Hence, the output will be "VB.Net".
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Cyrus Khan
Cyrus Khan 2 years ago
please review this answer the correct answer might be logical error