PrepAway - Latest Free Exam Questions & Answers

You need to implement the UpdateGrade() method

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?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

2 Comments on “You need to implement the UpdateGrade() method

  1. Andre Aranha says:

    I believe in A.

    Once the ReportCard is public, other process can lock on type or instance
    – So, B and C are leaning to a DEADLOCK;

    [MethodImpl] attribute works locking on type (for static members) or on the instance(for instance members). So, D could cause a DEADLOCK too.




    1



    0

Leave a Reply