Red Hat Interview Question

Question was based on Heap question