Samsung Electronics interview question

Some problem regarding dynamic memory allocation.