GATE CS 2026 Set 2 | Question 17

Programming & Data Structures › Advanced Concepts · MCQ · 1 mark · Answer: C

  1. Question 17Programming & Data Structuresmcq1 mark
    In C runtime environment, which one of the following is stored in heap?
    • A.
      A static variable declared inside a function
    • B.
      An array of integers declared inside a function
    • C.
      A dynamically allocated array of integers created using malloc() function call
      ✓
    • D.
      Return address of a function

    Answer: C

    Solution

    Answer: (C) Static variables live in the static/data segment; local (automatic) arrays and the return address live on the stack. Only memory obtained via malloc() is allocated on the heap.

More GATE PYQ on Advanced Concepts

All GATE CS Programming & Data Structures PYQ →

Attempt GATE CS 2026 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →