Red Hat interview question

Question was based on Heap question