Which storage option should you choose?

You are developing an application to assist the user in conducting electronic surveys.
The survey consists of 25 true-or-false questions.
You need to perform the following tasks:
Initialize each answer to true. Minimize the amount of memory used by each survey.
Which storage option should you choose?

You are developing an application to assist the user in conducting electronic surveys.
The survey consists of 25 true-or-false questions.
You need to perform the following tasks:
Initialize each answer to true. Minimize the amount of memory used by each survey.
Which storage option should you choose?

A.
BitVector32 answer = new BitVector32(1);

B.
BitVector32 answer = new BitVector32(-1);

C.
BitArray answer = new BitArray (1);

D.
BitArray answer = new BitArray (-1);

Explanation:
C & D BitVector32 is more efficient than a BitArray when 32 or less binary flags are required.
Primarily because it is a value type.
Note: we are not sure why B is preferred to A.



Leave a Reply 1

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