Dynamic memory allocation MCQs

By: Prof. Dr. Fazal Rehman | Last updated: May 14, 2025

36
Score: 0
Attempted: 0/36
Subscribe
1. : What is dynamic memory allocation?



2. : Which function is used to allocate memory dynamically in C?



3. : What is the return type of the malloc() function?



4. : What happens if malloc() fails to allocate memory?



5. : Which function is used to free dynamically allocated memory in C?



6. : What is the purpose of the calloc() function?



7. : What is the difference between malloc() and calloc()?



8. : What does the realloc() function do?



9. : What is a potential risk of dynamic memory allocation?



10. : Which of the following is true about dynamic memory?



11. : What is the purpose of the sizeof operator in dynamic memory allocation?



12. : What is the outcome of using free() on a pointer that is already freed?



13. : In which scenario would you use dynamic memory allocation?



14. : What is a common use case for dynamic memory allocation?



15. : Which function is used to allocate memory for a specific number of elements in C?



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



17. : What is the difference between stack and heap memory?



18. : What is a memory leak?



19. : What type of memory allocation does the new operator perform in C++?



20. : What is the purpose of the delete operator in C++?



21. : What is the syntax to allocate an array of integers dynamically in C?



22. : What will happen if you try to access memory that has already been freed?



23. : How do you check if malloc() succeeded?



24. : Which of the following can lead to fragmentation in dynamic memory allocation?



25. : What is the typical overhead for dynamic memory allocation?



26. : Which function can be used to determine the number of bytes allocated to a pointer in C?



27. : What does realloc() return if it fails to allocate the requested memory?



28. : In C++, what happens to dynamically allocated memory when the program exits?



29. : Which of the following scenarios requires dynamic memory allocation?



30. : What is the memory allocation technique called when the size of memory is not known beforehand?



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



32. : Which of the following functions is used for memory allocation in C++?



33. : What is the purpose of the new[] operator in C++?



34. : What will happen if you forget to use delete on a dynamically allocated object in C++?



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



36. : In C, how do you allocate memory for a structure dynamically?



 

 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQs 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs

 

All Copyrights Reserved 2025 Reserved by T4Tutorials