Solved

Which of the Following Code Segments Creates a New File

Question 3

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

Related Questions