You are writing a method to compress an array of bytes. The array is passed to the method in a
parameter named document. You need to compress the incoming array of bytes and return the
result as an array of bytes. Which code segment should you use?
A. Dim objStream As New MemoryStream(document)
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)
Dim result(document.Length) As Byteobj
Deflate.Write(result, 0, result.Length)Return result
B. Dim objStream As New MemoryStream(document)
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj
Deflate.Write(document, 0, document.Length)obj
Deflate.Close()Return objStream.ToArray
C. Dim objStream As New MemoryStream()
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj
Deflate.Write(document, 0, document.Length)obj
Deflate.Close()Return objStream.ToArray
D. Dim objStream As New MemoryStream()
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)
Dim outStream As New MemoryStreamDim b As IntegerWhile (b =
objDeflate.ReadByte)
outStream.WriteByte(CByte(b))
End
WhileReturn outStream.ToArray
Answer: C
parameter named document. You need to compress the incoming array of bytes and return the
result as an array of bytes. Which code segment should you use?
A. Dim objStream As New MemoryStream(document)
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)
Dim result(document.Length) As Byteobj
Deflate.Write(result, 0, result.Length)Return result
B. Dim objStream As New MemoryStream(document)
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj
Deflate.Write(document, 0, document.Length)obj
Deflate.Close()Return objStream.ToArray
C. Dim objStream As New MemoryStream()
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)obj
Deflate.Write(document, 0, document.Length)obj
Deflate.Close()Return objStream.ToArray
D. Dim objStream As New MemoryStream()
Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)
Dim outStream As New MemoryStreamDim b As IntegerWhile (b =
objDeflate.ReadByte)
outStream.WriteByte(CByte(b))
End
WhileReturn outStream.ToArray
Answer: C
No comments:
Post a Comment