Microsoft interview question

How memory is allocated in the stack and heap