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
Dim str as String
Dim msg as String
If str.toUpper="VISUAL BASIC"
msg="VB.Net"
Else
msg="Not Visual Basic"
EndIf
A. VB.Net
B. Not Visual Basic
C. Logical Error
D. Compiler Error
Answer: Option A
Solution (By Examveda Team)
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".Join The Discussion
Comments (1)
Related Questions on Visual Basic
Which of the following extension is used to represent the project file in Visual Basic?
A. .vbp
B. .vb
C. .cls
D. .vvb
Which of the following applications can be developed using Visual Basic tool?
A. Graphical User Interface
B. Real-time
C. Character User Interface
D. All of the mentioned
In visual basic language what are the rules of a programming language called?
A. Grammar
B. Order
C. Syntax
D. Rules

please review this answer the correct answer might be logical error