Which of the following code segments writes the contents of three parallel array
ID: 3575356 • Letter: W
Question
Which of the following code segments writes the contents of three parallel arraysnamed strStudentName, intID, and strMajor to a file in the format below? Assume all arrays have the same number of elements.
Vince Student, 1234, Computer Science
Nancy Student, 4321, Electrical Engineering
Select one:
a. For intCount = 0 to strStudentName.Length - 1
outputFile.Write(strStudentName(intCount)
outputFile.Write(", ")
outputFile.Write(intID(intCount))
outputFile.Write(", ")
outputFile.WriteLine(strMajor(intCount))
Next intCount
b. For intCount = 0 to strStudentName.Length - 1
outputFile.Write(strStudentName(intCount))
outputFile.Write(", ")
outputFile.Write(intID(intCount))
outputFile.Write(", ")
outputFile.Write(strMajor(intCount))
Next intCount
c. For intCount = 1 to strStudentName.Length
outputFile.Write(strStudentName(intCount)
outputFile.Write(", ")
outputFile.Write(intID(intCount))
outputFile.Write(", ")
outputFile.Write(strMajor(intCount))
Next intCount
d. For intCount =0 to strStudentName.Length - 1
outputFile.WriteLine(strStudentName(intCount) & ", ")
outputFile.WriteLine(intID(intCount) & ", ")
outputFile.WriteLine(strMajor(intCount))
Next intCount
Explanation / Answer
Answer: Option: a. For intCount = 0 to strStudentName.Length - 1
outputFile.Write(strStudentName(intCount)
outputFile.Write(", ")
outputFile.Write(intID(intCount))
outputFile.Write(", ")
outputFile.WriteLine(strMajor(intCount))
Next intCount
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.