Question:You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the method in a parameter named document. You need to compress the contents of the incoming parameter. Which code segment should you use? 

A MemoryStream outStream = new MemoryStream();
GZipStream zipStream = new GZipStream(outStream,
CompressionMode.Compress);
zipStream.Write(document, 0, document.Length);
zipStream.Close();
return outStream.ToArray(); 

B MemoryStream inStream = new MemoryStream(document);
GZipStream zipStream = new GZipStream(inStream,
CompressionMode.Compress);
byte[] result = new byte[document.Length];
zipStream.Write(result, 0, result.Length);
return result; 

C MemoryStream stream = new MemoryStream(document);
GZipStream zipStream = new GZipStream(stream,
CompressionMode.Compress);
"A Composite Solution With Just One Click" - Certification Guaranteed 306 Microsoft 70-536 Exam
zipStream.Write(document, 0, document.Length);
zipStream.Close();
return stream.ToArray(); 

D MemoryStream inStream = new MemoryStream(document);
GZipStream zipStream = new GZipStream(inStream,
CompressionMode.Compress);
MemoryStream outStream = new MemoryStream();
int b;
while ((b = zipStream.ReadByte()) != -1) {
outStream.WriteByte((byte)b);
}
return outStream.ToArray(); 

+ Answer
+ Report
Total Preview: 1187

Copyright © 2024. Powered by Intellect Software Ltd