Question

In C runtime environment, which one of the following is stored in heap?

Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2026 answer key

Solution

Distinguish between data segment (static), stack segment (local variables and return addresses), and heap segment (dynamic allocation).

In the C runtime memory layout:

  • Static variables are stored in the static/data segment.
  • Local arrays declared inside a function and function return addresses are stored in the activation record on the runtime stack.
  • Memory allocated dynamically at runtime via malloc(), calloc(), or realloc() is allocated on the heap.
Final answer

Option (C)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 2 (CS2)
Question
17 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.