PrepAway - Latest Free Exam Questions & Answers

You need to implement the UpdateScore() method

You are adding a public method named UpdateScore toa public class named ScoreCard.
The code region that updates the score 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 UpdateScore() method.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

3 Comments on “You need to implement the UpdateScore() method

  1. Daniel says:

    Answer is B

    [MethodImpl(MethodImplOptions.Synchronized)]
    public void Method()
    {
    MethodImpl();
    }

    Is the same as doing

    public void Method()
    {
    lock(this)
    {
    MethodImpl();
    }
    }

    Which is not best practise




    1



    0

Leave a Reply