exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 78 discussion

Actual exam question from Microsoft's 70-483
Question #: 78
Topic #: 2
[All 70-483 Questions]

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
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Xavios
Highly Voted 5 years, 7 months ago
answer D
upvoted 18 times
...
Nyxius
Highly Voted 5 years, 7 months ago
how about D?
upvoted 16 times
...
DaGrooveNL
Most Recent 3 years, 10 months ago
FINAL ANSWER: D.
upvoted 1 times
...
noussa
3 years, 11 months ago
A would work if signatureAlgo.TransformBlock(fileBuffer, 0, fileBuffer.Length – 1, fileBuffer, 0); signatureAlgo.TransformFinalBlock(fileBuffer, fileBuffer.Length -1, 1); return signatureAlgo.Hash; so its D
upvoted 1 times
...
demoinq
4 years ago
I don't understand why you Gentlemen don't use Visual Studio to verify: using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace HashTest { class Program { public static byte[] GetHash(string filename, string algorithmType) { var hasher = HashAlgorithm.Create(algorithmType); var fileBytes = System.IO.File.ReadAllBytes(filename); var x = hasher.ComputeHash(fileBytes); foreach (byte b in x) Console.Write(b); return hasher.Hash; } static void Main(string[] args) { var hash = GetHash(@"c:\test.txt", "SHA1"); Console.WriteLine(); foreach (byte b in hash) Console.Write(b); Console.ReadLine(); } } } You can clearly see that ComputeHash() computes the hash that is later on available in the Hash property. The answer is D.
upvoted 8 times
...
Mona30
4 years, 3 months ago
there is a similar question (#16) on page 22, slightly different answers... but its says correct answer is D
upvoted 2 times
...
edmondme
4 years, 4 months ago
I did couple of tests and I think if D was return hasher.ComputeHash(fileBytes); then yes that would have been it. But you need to call hasher.HashFinal(); before getting the property hasher.Hash. So I think they are right, A is the correct answer to Transform the data before return. BurgSharp is partially correct, we are missing hasher.HashFinal();
upvoted 1 times
...
mchen
4 years, 8 months ago
Answer D need some change to be correct: var data = hasher.ComputeHash(fileBytes) return data.Hash
upvoted 1 times
...
dominikeps
4 years, 9 months ago
whalla d answer
upvoted 2 times
...
sscooter1010
4 years, 10 months ago
Seems like D is the best answer.
upvoted 3 times
...
Khanyie
5 years ago
D is the answer
upvoted 2 times
...
dakuan
5 years, 1 month ago
D is correct.
upvoted 3 times
...
coding_caveman
5 years, 2 months ago
A doesn't make sense with the call to TransformFinalBlock (but should work) D doesn't return a byte array as mentioned I think C is most correct
upvoted 2 times
coding_caveman
5 years, 2 months ago
Oh, sorry. No D is actually correct, remove this.
upvoted 5 times
...
...
user123
5 years, 3 months ago
it is d?
upvoted 1 times
...
dosper
5 years, 3 months ago
It's D
upvoted 4 times
...
Bio
5 years, 5 months ago
ComputeHash returns the hash so it is not D
upvoted 3 times
BurgSharp
4 years, 5 months ago
it indeed returns, but you COULD ignore it and get it from HashAlgorithm.Hash
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago