Based on the following memory layout, answer the following question.
Consider the following C program:
#include <stdio.h>
int iglobal = 10;
int uglobal;
int main(void)
{
static int i;
int j;
return 0;
}
Question #46: Where does the variable ‘j’ go?
Options:
- heap
- Uninitialized data (bss)
- Stack
- Initialized data
Solution: ‘j’ is a local variable, all local variables go to stack. Hence, the correct answer is option 3. Checkout a similar question here.

