Features of Read only variables

  1. It is allocated at compile time

  2. Declaration and initialization is separated

  3. It is allocated at runtime

  4. all of these


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) It is allocated at compile time - This option is incorrect. Read-only variables are not necessarily allocated at compile time. The allocation of memory for read-only variables can happen at either compile time or runtime, depending on the programming language and the specific implementation.

Option B) Declaration and initialization is separated - This option is incorrect. The separation of declaration and initialization is not a specific feature of read-only variables. It depends on the programming language and the specific syntax rules.

Option C) It is allocated at runtime - This option is correct. One of the features of read-only variables is that they can be allocated at runtime. This means that the memory for read-only variables is allocated during the execution of the program, rather than at compile time.

Option D) All of these - This option is incorrect. Only option C is correct. Options A and B are incorrect.

The correct answer is C) It is allocated at runtime. This option is correct because read-only variables can be allocated at runtime.

Find more quizzes: