You are developing a method named GetHash that will return a hash value for a file. The method
includes the following code. (Line numbers are included for reference only.)
You need to return the cryptographic hash of the bytes contained in the fileBytes variable.
Which code segment should you insert at line 05?

A.
Option A
B.
Option B
C.
Option C
D.
Option D
I am pretty sure, it’s C. Take a look into the example for TransformFinalBlock in the MSDN to see that the code won’t work: https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.transformfinalblock(v=vs.110).aspx
0
1
seems to be D
https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.hash(v=vs.110)
http://www.aiotestking.com/microsoft/which-code-segment-should-you-insert-at-line-05-37/
2
0
It is D!
2
0
Agree with D
2
0
seems to be D, @see https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm(v=vs.110).aspx
1
0
It is not D because it calls .Hash property on a byte array and that does not exist. I would say that A is correct because the TransformBlock method must be called before the TransformFinalBlock method according to msdn
https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.transformfinalblock(v=vs.110)
0
3
What do in A answer code:
hasher.TransformFinalBlock(fileBytes, fileBytes.Length – 1, fileBytes.Length); ?
This code does not modify the outputBuffer.
0
0