Memory Allocation and Deallocation MCQs

36 min
Score: 0
Attempted: 0/36
Subscribe
1. What is the primary purpose of memory allocation in a program?



2. Which of the following is a dynamic memory allocation function in C++?



3. What is the term for memory that is allocated at compile time?



4. Which of the following functions is used to deallocate memory in C?



5. What is a memory leak?



6. Which memory allocation method allows a program to request more memory at runtime?



7. What is the role of the heap in memory allocation?



8. What happens when a program tries to access memory that has already been deallocated?



9. What is the difference between stack and heap memory?



10. Which function in C++ is used to release memory allocated with new?



11. What does the term “fragmentation” refer to in memory allocation?



12. What type of allocation occurs when a program requests memory without knowing the size at compile time?



13. What is the primary purpose of the malloc() function in C?



14. Which of the following is true about the “delete” operator in C++?



15. What can lead to undefined behavior in a program?



16. What is the consequence of using the free() function on a pointer that has not been allocated memory?



17. Which memory allocation technique allows the reuse of freed memory?



18. What does the term “garbage collection” refer to in programming?



19. Which of the following is a method to reduce memory fragmentation?



20. What type of memory allocation is typically used for local variables in functions?



21. Which of the following can lead to stack overflow?



22. What is the purpose of realloc() in C?



23. In which memory area are global variables typically stored?



24. Which of the following statements about memory allocation is false?



25. What is a common issue when using dynamic memory allocation in C/C++?



26. What is the purpose of the free() function?



27. Which of the following is an effect of using too much heap memory?



28. What is the main advantage of using dynamic memory allocation?



29. What happens to local variables when a function exits?



30. What is the purpose of a memory pool in dynamic allocation?



31. In C++, what does the term “smart pointer” refer to?



32. What is a potential drawback of using dynamic memory allocation?



33. Which of the following is not a type of dynamic memory allocation?



34. What happens if you forget to free dynamically allocated memory?



35. What does the term “stack frame” refer to?



36. What is a common approach to managing memory allocation in embedded systems?



Contents Copyrights Reserved By T4Tutorials