In C runtime environment, which one of the following is stored in heap?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2026 Set 2 · Q17
Time
Select one answerSingle correct
Solution
Official answer: C) A dynamically allocated array of integers created using malloc() function call
Programming in CIn the standard C memory layout:
Data / BSS Segment: Stores global variables and static variables, regardless of whether they are declared inside or outside a function (Option A).
Stack: Stores function activation records/call frames, which include local (automatic) variables (such as a local array declared in a function, Option B) and the return address of a function (Option D).
Heap: Used for dynamic memory allocation at runtime via functions such as malloc(), calloc(), realloc() (Option C).
Therefore, dynamically allocated memory created using malloc() is stored in the heap, making C the correct option.
Try the question first, then check your work.
Examiner trap
Identify which segment of program memory is specifically designated for dynamic memory allocation performed via library calls at runtime.
This Programming in C previous year question is Q17 of the GATE CSE 2026 Set 2 paper. Find more GATE CSE PYQs on Programming in C in Programming and Data Structures, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Programming in C PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Programming in C has 74 GATE CSE PYQs across 25 papers from 2011 to 2026. 20 of them are 1-mark MCQs like this one, and GATE CSE 2026 Set 2 has 3.
How GATE tests Programming in CIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.