Stack overflow is for number of elements , where heap overflow going beyond range.
Stack overflow- Say An array can store 3 elements, and we want to put 4 elements in it, then it is stack overflow.
Heap overflow-If there are elements write beyond range, then it is heap overflow.
Ans B) Both are heap overflow.
PS-[Though we think there are unlimited space in heap, but actually no computer device can store unlimited space.So, heap overflow actually happens when there is infinite calling of function.]