434 views
4 votes
4 votes
Which of the following is/are correct? (Mark all the appropriate choices)

  1. The Data section is reserved for local variables when they are declared.
  2. The Heap is made up of the global and static variables, allocated and initialized prior to executing the main.
  3. The space on the Stack is used for the dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc.
  4. The Text section is made up of the compiled program code, read in from non-volatile storage when the program is launched.

1 Answer

Best answer
12 votes
12 votes
The space on the Stack is reserved for local variables when they are declared. These are static size (size of allocation is known even before the program run) allocations and are created and freed whenever these variables life starts and ends during a function call/return.

The Data section is made up of the global and static variables, allocated and initialized prior to executing the main. These are static size allocations and they are not freed until the program run finishes. Some of the Data section contents are R/W but some are Read Only (RO) like those used for string literals.

The Heap is used for the dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc. These are dynamically allocated and the size of allocation depends on the runtime values.

The Text section is made up of the compiled program code, read in from non-volatile storage when the program is launched. They are typically Read Only (RO).
selected by
Answer:

Related questions

2 votes
2 votes
1 answer
2
gatecse asked Nov 15, 2020
105 views
Processes in an operating system can be in any of the following states. Choose the proper matching for the given table.$\begin{array}{|l|l|l|}\hline& \textbf{Process Stat...
4 votes
4 votes
1 answer
4