Features of readonly variables

- It is allocated at compile time
- Declaration and initialization can be separated
- It is initialized at run time
- all of these

CORRECT ANSWER : all of these

Discussion Board
Hint is in the first line

The question would be easier if the options used the phrase 'can be' (but testers don't have to make questions easy). The hint is 'Features of' in the first line.
A readonly variable can be assigned a value inline (or not).
A readonly variable can be assigned a value in the constructor (value not known until runtime).
The above therefore gives you separation of declaration and initialization.

Ackroydd 04-19-2015 11:00 AM

Incoherence between A and C

Actually if you say it can be allocated at compile time, then you are assuming it must be at runtime also. But the problem in here is HOW. I personally agree with B, but at compile time, depending on the IDE, the compiler is just accomplishing grammar and token variations but it is not really allocating nothing. Now, if you are debugging and/or running code, then your allocating because you creating the values and objects.
Am I right? If not please answer back.

Yeinier 01-19-2015 08:10 PM

Problems with Read only question

The term is readonly, not read only.
All of the above, the correct answer cannot be correct when A and C are mutually exclusive. I believe C should be it is initialized at run time. It currently say allocated.

Jeff Walker 12-15-2013 03:20 PM

Partial error in question

I think 'b' should read:

Declaration and initialization CAN BE separated.


Andrew Cope 10-26-2013 03:42 AM

Write your comments


Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)