Memory Management Techniques (Static, Stack, and Heap) MCQs December 19, 2025December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. Which memory allocation occurs at compile time? (A) Static allocation (B) Stack allocation (C) Heap allocation (D) Dynamic allocation 2. Which memory region stores local variables of a function? (A) Static memory (B) Heap (C) Stack (D) Register 3. Which memory allocation allows variable size at runtime? (A) Static allocation (B) Heap allocation (C) Stack allocation (D) None of the above 4. Memory allocated on the heap must be: (A) Automatically freed (B) Stored in registers (C) Explicitly freed by the programmer (D) Only used for constants 5. Which memory region persists for the lifetime of the program? (A) Stack (B) Heap (C) Static memory (D) CPU cache 6. Which memory management technique follows Last-In-First-Out (LIFO)? (A) Static memory (B) Stack allocation (C) Heap allocation (D) Virtual memory 7. Which of the following is an advantage of heap memory? (A) Faster allocation than stack (B) Automatically deallocated (C) Can allocate large and variable-sized blocks (D) LIFO access 8. Which memory allocation is typically used for global variables? (A) Stack (B) Heap (C) Static memory (D) CPU cache 9. What happens when stack memory overflows? (A) Stack overflow error occurs (B) Program continues normally (C) Heap is automatically used (D) Static memory is allocated 10. Which memory management technique is used in recursion? (A) Static memory (B) Register allocation (C) Heap allocation (D) Stack allocation 11. Dynamic memory allocation is usually done in which region? (A) Heap (B) Stack (C) Static memory (D) ROM 12. Which of the following is true for static memory? (A) Allocation size can vary at runtime (B) Stored in heap (C) Memory is freed automatically after function execution (D) Lifetime is determined at compile time 13. Stack memory is automatically freed when: (A) The function returns (B) The program ends (C) Memory allocation fails (D) Explicitly deallocated by programmer 14. Which memory type can cause fragmentation if not managed carefully? (A) Stack (B) Heap (C) Static memory (D) ROM 15. Which memory region is generally faster to access? (A) Heap (B) Stack (C) Static memory (D) Disk 16. Which allocation is suitable for temporary data? (A) Stack memory (B) Static memory (C) Heap memory (D) Global memory 17. Which memory allocation allows sharing of variables across functions? (A) Heap (B) Stack (C) Static memory (D) CPU cache 18. What is a major disadvantage of heap allocation? (A) Automatically deallocated (B) Memory is LIFO only (C) Cannot store large objects (D) Slow allocation and deallocation 19. Which memory is used for constant values? (A) Static memory (B) Stack (C) Heap (D) CPU registers 20. Which memory type grows downward in most systems? (A) Heap (B) Stack (C) Static memory (D) Cache 21. Which of the following is true for heap memory allocation? (A) Managed automatically like stack (B) Must use malloc/free or new/delete in C/C++ (C) Cannot allocate variable size (D) Only used for constants 22. What is memory leak? (A) Stack memory allocation (B) Memory accessed correctly (C) When memory is allocated but not freed (D) Static memory allocation 23. Which memory type is most suitable for large arrays created at runtime? (A) Stack (B) Static memory (C) Heap (D) Register 24. Which memory allocation method is safe from memory leaks if used properly? (A) Heap allocation (B) Stack allocation (C) Static memory (D) All of the above 25. Which memory is initialized only once before the program starts? (A) Stack (B) Heap (C) Static memory (D) Register 26. Which memory management technique is best for recursive function calls? (A) Static memory (B) Heap memory (C) Stack memory (D) Constant memory 27. Which allocation type requires programmer intervention to free memory? (A) Heap (B) Stack (C) Static (D) Register 28. Which memory type may lead to stack overflow in case of deep recursion? (A) Static memory (B) Global memory (C) Heap memory (D) Stack memory 29. What is the main advantage of static allocation? (A) Flexible size at runtime (B) Can allocate large blocks at runtime (C) Automatically freed (D) Lifetime known at compile time and fast access 30. Which memory type is generally used for objects whose lifetime extends beyond the scope of a function? (A) Stack (B) Static memory (C) Heap (D) Registers