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()
```
c. ```Dim addressFile As System.IO.StreamWriter
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.WriteLine(“Bob Johnson”)
addressFile.WriteLine(“Somewhere USA”)
addressFile.Close()
```
You might also like to view...
If you were to write a function for displaying the cost of an item to the screen, which function prototype would be most appropriate?
a. void display(); b. void display(float myCost); c. int display (float myCost); d. float display();
Suggest two advantages that rpm files have over source distributions.
What will be an ideal response?
?List the advantages of working from a grid and the basic types of grid layouts.
What will be an ideal response?
Which of the following would be the best example of an event-controlled loop?
A. Print a number backward. B. Validate data read from the keyboard. C. Print a calendar. D. Read and print the sum of a variable series of numbers.