Users Online

· Guests Online: 46

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

C# Questions & Answers ? Introduction of Stream Classes

C# Questions & Answers – Introduction of Stream Classes

 

 

This section of our 1000+ C# MCQs focuses on introduction of stream classes in C# Programming Language.

 

 

 

1. Select the namespace on which the stream classes are defined?
a) System.IO
b) System.Input
c) System.Output
d) All of the mentioned

Answer: a
Explanation: The core stream classes are defined within the System.IO namespace. To use these classes, you will usually include the following statement near the top of your program: using System.IO;

 

 

 

2. Choose the class on which all stream classes are defined?
a) System.IO.stream
b) Sytem.Input.stream
c) System.Output.stream
d) All of the mentioned

Answer: a
Explanation: The core stream class is System.IO.Stream. Stream represents a byte stream and is a base class for all other stream classes. It is also abstract, which means that you cannot instantiate a Stream object. Stream defines a set of standard stream operations.

 

 

 

3. Choose the stream class method which is used to close the connection?
a) close()
b) static close()
c) void close()
d) none of the mentioned

Answer: c
Explanation: void close() closes the stream.
 

 

 

4. The method used to write a single byte to an output stream?
a) void WriteByte(byte value)
b) int Write(byte[] buffer ,int offset ,int count)
c) write()
d) none of the mentioned

Answer: a
Explanation: Writes a single byte to an output stream.

 

 

 

5. Select the method which writes the contents of the stream to the physical device.
a) fflush()
b) void fflush()
c) void Flush()
d) flush()

Answer: c
Explanation: The method used to write the contents of the stream to the physical device.
 

 

 

6. Select the method which returns the number of bytes from the array buffer:
a) void WriteByte(byte value)
b) int Write(byte[] buffer, int offset, int count)
c) write()
d) none of the mentioned

Answer: b
Explanation: Writes a subrange of count bytes from the array buffer, beginning at buffer[offset], returning the number of bytes written.

 

 

 

 

7. Name the method which returns integer as -1 when the end of file is encountered.
a) int read()
b) int ReadByte()
c) void readbyte()
d) none of the mentioned

Answer: b
Explanation: Returns an integer representation of the next available byte of input. Returns –1 when the end of the file is encountered.

 

 

 

 

8. Select the statements which define the stream.
a) A stream is an abstraction that produces or consumes information
b) A stream is linked to a physical device by the I/0 system
c) C# programs perform I/O through streams
d) All of the mentioned

Answer: d
Explanation: None.

 

 

 

9. Select the action of the method long seek()?
a) Attempts to readup to count bytes into buffer starting at buffer[offset]
b) Writes a single byte to an output stream
c) Sets the current position in the stream to the specified offset from specified origin and hence returns the new position
d) None of the mentioned

10. Which among the following attempts to read up to count bytes into buffer starting at buffer[offset], returning the number of bytes successfully read?
a) int ReadByte()
b) int Read(byte[] buffer, int offset, int count)
c) Void WriteByte(byte value)
d) None of the mentioned

Answer: b
Explanation: None.

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.74 seconds
10,843,239 unique visits