nerdexam
Microsoft

98-372 · Question #64

Which class reads lines of data from a byte stream stored in a text file in a particular encoding?

The correct answer is C. StreamReader class. The StreamReader class is derived from the System.IO namespace. It is implemented by the TextReader class. It reads lines of data from a byte stream stored in a text file in a particular encoding. By default, it supports UTF-8 encoding for character input. Answer: D is incorrect.

Understanding .NET Framework Concepts

Question

Which class reads lines of data from a byte stream stored in a text file in a particular encoding?

Options

  • ATextReader class
  • BBufferedStream class
  • CStreamReader class
  • DBinaryReader class

How the community answered

(20 responses)
  • A
    5% (1)
  • B
    5% (1)
  • C
    75% (15)
  • D
    15% (3)

Explanation

The StreamReader class is derived from the System.IO namespace. It is implemented by the TextReader class. It reads lines of data from a byte stream stored in a text file in a particular encoding. By default, it supports UTF-8 encoding for character input. Answer: D is incorrect. The BinaryReader class is used to read primitive data types as binary values in a specific encoding. Characters can be read from the stream using the given encoding system. The default encoding system is equal to New UTF8Encoding. Answer: A is incorrect. The TextReader class is used to provide a reader that can read a sequential chain of characters. It is the abstract base class of the StreamReader and StringReader classes. These derived classes can be used to open a text file for reading a specified range of characters, or to create a reader based on an existing stream. A derived class must at least implement the Peek and Read methods to make a functional instance of the TextReader class. Answer: B is incorrect. The BufferedStream class adds a buffering layer to read and write operations on another stream. It can be composed more or less for specific types of streams. It provides implementations for reading and writing bytes to an underlying data source. The BufferedStream class is designed to prevent the buffer from slowing down input and output when the buffer is not required. It also buffers reads and writes in a shared buffer.

Topics

#StreamReader#file I/O#byte stream#text encoding

Community Discussion

No community discussion yet for this question.

Full 98-372 Practice