What displays in the label when the code below executes? Dim s As String = \"col
ID: 3792763 • Letter: W
Question
What displays in the label when the code below executes? Dim s As String = "colander" lblOut. Text = s-Index of ("o") -1 0 1 2 What displays in the label when the code below executes? Dim s As String = "watermelon" lblOut. Text = s. Substring (1, 4) ate wat ater wate Which of the following functions returns a String value? Which of the following function returns a string value? CDbl Clint IndexOf What is the value of the expression: Chr (98)? 98 a b B What is displayed in the label? Dim s As String = "May 7, 2006" lblOut = Text- s.ToUpper May 7, 2006 MAY 7, 2006 MAY&Explanation / Answer
1. What displays in the label when the code below executes?
Dim s As String = “colander”
lblOut.Text = s.IndexOf(“o”)
Answer: c.1
Explanation: The IndexOf function scans the string and returns the index of the substring.
In the above example, we have the string “colander” and s.IndexOf(“o”) returns the index of o in “colander”. As indexing starts from 0, the function return 1 and 1 is displayed in the label
2. What displays in the label when the code below executes?
Dim s As String = “watermelon”
lblOut.Text = s.Substring(1,4)
Answer: c. ater
Explanation: The Substring method returns a string which is the part of the original string. It takes start index and the length (number of characters) as parameters and returns the substring.
In the above example “watermelon” is the string, now s.Substring(1,4) returns a string starting at index 1 and 4 characters from 1 i.e., 1 is the index of a and 4 characters from there return ater.
3. Which of the following functions returns a String value?
Answer: d. Substring
Explanation: In the above given options CDbl returns a double, CInt returns an integer, IndexOf returns and integer while Substring returns a string.
4. What is the value of the expression: Chr(98)
Answer: c. b
Explanation: Chr(98) converts 98 into an equivalent character. Here 98 is the ASCII value of ‘b’ and hence returns ‘b’.
5. What is displayed in the label?
Dim s As String = “May 7, 2006”
lblOut.Text = s.ToUpper
Answer: b. MAY 7,2006
Explanation: ToUpper converts the lowercase letters in a string to uppercase, any other characters other than alphabets i.e., special characters or numbers will be ignored that is left as it is.
Hence s.ToUpper return MAY 7, 2006
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.