In the following segments which is the read only segment?
-
Heap
-
Stack
-
Code Segment
-
Data Segment
C
Correct answer
Explanation
The code segment (also called the text segment) stores the program's compiled machine instructions and is read-only to prevent self-modification. Heap and stack are dynamic memory areas used for read-write operations during program execution, while the data segment contains initialized and uninitialized global/static variables that can be modified.