If I wanted to write a free-form file, I could use the FreeFormWriter class instead of the StreamWriter class.
| The following code will fail if the input file is empty. Dim reader As New StreamReader("foo.txt") Dim record As String record = CurrentReader.ReadLine() If record <> Nothing Then If record = "Header" Then record = CurrentReader.ReadToEnd() End If End If | False The easiest and most efficient way to read a free-form file is to read each character one at a time using the StreamReader.Read() method. | False If you wanted to read a comma-delimited file, the following statement will read a record into the array of strings: Dim reader As New StreamReader("C:\filetest.txt") Dim fields() As String fields = reader.ReadDelimited(",") Which of the following statements is correct of the various .NET dialog boxes. a. | All of the dialog boxes are ultimately derived from the CommonDialog class. | b. | The Filter property is a collection. Each item in the Filters collection defines a filter used to restrict the files displayed in the dialog box. | c. | To display folders instead of files, you set the Folder property to True for the OpenFileDialog or SaveFileDialog | d. | When a dialog box is displayed, the initial directory displayed is always the root directory. | e. | The SaveFileDialog uses the StreamWriter class to save files. | | | |
| |
Which of the following statements is correct of the StreamReader class? Check all that apply
a. | One overloaded version of the constructor contains one argument - the name of the file to open. |
b. | The Read() method reads one character from an open file and returns Integer. |
c. | If you call the ReadLine() method on an open file, and end-of-file has been reached, then the ReadLine() method will return Nothing. |
d. | After a file has been read completely, the file is implicitly closed. That is, you do not have to call the Close() method. |
e. | If you were to call the Read() method on an open file, the file contents will be read from the current file position to the end of the file. The Read() method returns a String. |
If I were writing a comma-delimited sequential file, I would call the ____________[ Select ONE] : ["Write()", "WriteCharacter()", "WriteLine()", "WriteDelimiter()"] Write() method to write each field except for the last field. I would call the [Select ONE]["Write()", "WriteDelimiter()", "WriteLine()", "WriteCharacter()"] WriteLine() method to write the last field so as to write the carriage return
Which of the following statements is correct of fixed-field files.
a. | .NET does not support classes and methods to read and write fixed -field files. |
b. | Using a fixed-field file, each field begins at a specific character position. |
c. | They would be considered an unstructured for free-form file. |
d. | You can use the Split() method of the String class to parse a a record in a fixed-file. |
Given the following code segment, which of the following statements is correct?
Dim DelimiterChars() As Char = {ToChar(","), ToChar("#")}
a. | The statement will cause a syntax error because the initialization string is not correct. |
b. | A 2-character delimiter is being declared. The characters are ,# |
c. | Given the way that the StreamReader operates, the delimter character is a comma , and the end-of-line (record) character is the hash tag #. |
d. | The statement will cause a syntax error because you cannot declare an array of type Char. |
A delimited file has one or more [Select ONE]["fields", "delimiters", "characters", "records"] containing one or more [Select]["records", "characters", "fields", "delimiters"] separated by a [Select ONE]["space", "line break", "new line", "delimiter"]
What is the name of the StreamReader method that you would call to look at the next character to be read from the input stream?
Given the following code segment. which of the following is correct? Assume that CurrentReader is an instance of the StreamReader class. Check all that apply.
Dim DelimiterChars() As Char = {ToChar(",")} Dim Fields() As String CurrentRecord = CurrentReader.ReadLine() Fields = CurrentRecord.Split(DelimiterChars)
a. | The comma is designated as the delimiter character. |
b. | The program will not run because the array named Fields() has no size. The array's size must be the same as the number of fields in the record. Otherwise, the a subscript out of range error will occur. |
c. | While not shown in the above code, you can deduce that CurrentRecord has a data type of String. |
d. | While not shown in the above code, you can deduce that CurrentRecord as an array of strings. |
What is the name of the StreamReader or StreamWriter method that you would call after you have completed reading or writing a file.