Multiple choice technology programming languages

In the following code variable test would be created on? static int test;

  1. Heap

  2. Stack

  3. Code Segment

  4. Data Segment

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Static variables in C are stored in the data segment (specifically, the .data or .bss section depending on initialization). Unlike local variables which are on the stack, static variables retain their value across function calls and are allocated when the program starts, persisting for the entire program duration. Heap is for dynamic allocation (malloc/free) and code segment stores executable instructions.