Which three code segments should you insert in sequence at line 09?

DRAG DROP
You are developing an application that includes a class named Warehouse. The Warehouse class
includes a static property named Inventory- The Warehouse class is defined by the following code
segment. (Line numbers are included for reference only.)

You have the following requirements:
Initialize the _inventory field to an Inventory instance.
Initialize the _inventory field only once.
Ensure that the application code acquires a lock only when the _inventory object must be
instantiated.
You need to meet the requirements.
Which three code segments should you insert in sequence at line 09? (To answer, move the
appropriate code segments from the list of code segments to the answer area and arrange them in
the correct order.)

DRAG DROP
You are developing an application that includes a class named Warehouse. The Warehouse class
includes a static property named Inventory- The Warehouse class is defined by the following code
segment. (Line numbers are included for reference only.)

You have the following requirements:
Initialize the _inventory field to an Inventory instance.
Initialize the _inventory field only once.
Ensure that the application code acquires a lock only when the _inventory object must be
instantiated.
You need to meet the requirements.
Which three code segments should you insert in sequence at line 09? (To answer, move the
appropriate code segments from the list of code segments to the answer area and arrange them in
the correct order.)

Answer:

Explanation:
After taking a lock you must check once again the _inventory field to be sure that other threads
didn’t instantiated it in the meantime.



Leave a Reply 2

Your email address will not be published. Required fields are marked *


YouCrackedMeUp

YouCrackedMeUp

Some of questions makes us confused, that’s why we should read it sensibly. The first time I understand this question is to follow sequentially on what given so I chose 5,4,3 but the correct answer is 4,3,5