Solved

Which of the Following Code Segments Creates a New File

Question 18

Multiple Choice

Which of the following code segments creates a new file named address.txt, writes the following two lines to the file, and then closes the file? Bob Johnson
Somewhere USA


A) Dim addressFile As System.IO.StreamWriter addressFile = System.IO.File.CreateText("address.txt")
AddressFile.Write("Bob Johnson")
AddressFile.Write("Somewhere USA")
Address.txt.Close()
B) Dim addressFile As System.IO addressFile = System.IO.File.CreateText("address.txt")
AddressFile.WriteLine("Bob Johnson")
AddressFile.WriteLine("Somewhere USA")
AddressFile.Close()
C) Dim addressFile As System.IO.StreamWriter addressFile = System.IO.File.CreateText("address.txt")
AddressFile.WriteLine("Bob Johnson")
AddressFile.WriteLine("Somewhere USA")
AddressFile.Close()
D) Dim addressFile As StreamWriter addressFile = System.IO.File.CreateText("address.txt")
AddressFile.PrintLine("Bob Johnson")
AddressFile.PrintLine("Somewhere USA")
Close()

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