What should you do?

You are adding a public method named UpdateGrade to a public class named ReportCard.

The code region that updates the grade field must meet the following requirements:

• It must be accessed by only one thread at a time.

• It must not be vulnerable to a deadlock situation.

You need to implement the UpdateGrade() method.

What should you do?

A . Option A
B . Option B
C . Option C
D . Option D

Answer: A

Explanation:

Because the class is public, you need a private lock Object.

Incorrect:

Not B, not C: Once the ReportCard is public, other process can lock on type or instance.

So, these options are leaning to a DEADLOCK.

Not D: [MethodImpl] attribute works locking on type (for static members) or on the instance(for instance members). It could cause a DEADLOCK.

Reference: https://msdn.microsoft.com/en-us/library/c5kehkcz.aspx

Latest 70-483 Dumps Valid Version with 288 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments