What output will be returned if the following Visual Basic code is executed? strVisualBasic = “Sanfoundry, VB.Net” intCharIndex = strVisualBasic.IndexOf(“VB”)

11
12
FALSE
TRUE

The correct answer is A. 11.

The IndexOf method returns the index of the first occurrence of a specified string within a string. In this case, the string “VB” is found at index 11, so the output is 11.

Option B is incorrect because the string “VB” is found at index 11, not 12.

Option C is incorrect because the string “VB” is found, so the result is not False.

Option D is incorrect because the string “VB” is found, so the result is not True.

Exit mobile version