A developer has declared a variable of type String named StrVar and assigned it the value "UIPATH STUDIO". What is the output of the expression, StrVar.lndexOf("U")?
The IndexOf method of String values returns the index of the first occurrence of a specified character or substring in a given string. The index is zero-based, meaning that the first character has the index 0, the second character has the index 1, and so on. If the character or substring is not found, the method returns -1. In this case, the expression StrVar.IndexOf(“U”) returns the index of the first occurrence of the character “U” in the string “UIPATH STUDIO”, which is 0. Therefore, the answer is A. 0. References: String.IndexOf Method, String Variables
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit