Solved

Which of the Following Code Segments Is the Correct Solution

Question 16

Multiple Choice

Which of the following code segments is the correct solution for the following problem? Find the first occurrence of the value "Joe" in the array strNames. Save the index of the element containing "Joe" in a variable named intPosition. Discontinue searching the array once the first occurrence of the element "Joe" has been located. Assume any variables you need are already defined.


A) For intCount = 0 To strNames.length-1 If strNames(intCount) = "Joe" Then
IntPosition = intCount
End If
Next
B) blnFound = True intCount = 0
Do While (Not blnFound) And (intCount < = strNames.Length - 1)
If strNames(intCount) = "Joe" Then
BlnFound = False
Positon = intCount
End If
IntCount += 1
Loop
C) blnFound = False intCount = 0
Do While (Not blnFound) And (intCount < strNames.Length)
If strNames(intCount) = "Joe" Then
BlnFound = True
IntPosition = intCount
End If
IntCount += 1
Loop
D) blnFound = False For intCount = 0 to strNames.Length -1 and Not blnFound
If strNames(intCount) = "Joe" Then
BlnFound = True
IntPosition = intCount
End If
Next

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents