Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
C# Questions & Answers ? Byte Stream
C# Questions & Answers – Byte Stream
This section of our 1000+ C# MCQs focuses in detail on byte stream in C# Programming Language.
1. Which of these classes is used to read and write bytes in a file?
a) FileReader
b) FileWriter
c) FileInputStream
d) InputStreamReader
Explanation: None.
2. Which of these data types is returned by every method of OutputStream?
a) int
b) float
c) byte
d) none of the mentioned
Explanation: Every method of OutputStream returns void and throws an IOExeption in case of errors.
3. Which of these classes is used for input and output operation when working with bytes?
a) InputStream
b) Reader
c) Writer
d) All of the mentioned
Explanation: InputStream & OutputStream are designed for byte stream. Reader and writer are designed for character stream.
4. Which among the following is used for storage of memory aspects?
a) BufferedStream
b) FileStream
c) MemoryStream
d) None of the mentioned
Explanation: A byte stream that uses memory for storage.
5. Which among the following is used for storage of unmanaged memory aspects?
a) BufferedStream
b) FileStream
c) MemoryStream
d) UnmanagedMemoryStream
Explanation: A byte stream that uses unmanaged memory for storage.
6. Which property among the following represents the current position of the stream?
a) long Length
b) long Position
c) int Length
d) all of the mentioned
Explanation: This property contains the length of the stream. This property is read-only.
7. Choose the filemode method which is used to create a new output file with the condition that the file with same name must not exist.
a) FileMode.CreateNew
b) FileMode.Create
c) FileMode.OpenOrCreate
d) FileMode.Truncate
Explanation: Creates a new output file. The file must not already be existing.
8. Choose the filemode method which is used to create a new output file with the condition that the file with same name if exists will destroy the old file:
a) FileMode.CreateNew
b) FileMode.Create
c) FileMode.OpenOrCreate
d) FileMode.Truncate
Explanation: Creates a new output file. Any pre-existing file with the same name will be destroyed.
9. Which of these is a method used to clear all the data present in output buffers?
a) clear()
b) flush()
c) fflush()
d) close()
Explanation: None.
10. Which of these is a method used for reading bytes from the file?
a) clear()
b) ReadByte()
c) put()
d) write()
Explanation: FileStream defines two methods that reads bytes from a file: ReadByte() and Read().