Solved

Assume the File Alphabet

Question 18

Multiple Choice

Assume the file Alphabet.txt contains 26 records, the lowercase letters of the alphabet in ascending order. What happens when the following code is executed?
Dim letter As String
Dim sr As IO.StreamReader = IO.File.OpenText("Alphabet.txt")
Do While Not sr.EndOfStream
Dim sw As IO.StreamWriter = IO.File.CreateText(letter.ToUpper & ".txt") letter = sr.ReadLine
sw.WriteLine(letter.ToUpper & ".txt")
sw.Close
Loop
sr.Close


A) A "too many files open" error is produced.
B) Twenty-six files are created and named with one of the uppercase letters of the alphabet and each containing only its own file name.
C) A file called z is created containing all of the letters of the alphabet in lowercase.
D) An "invalid file name" error is produced.

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