Memory Management in data structures MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 14, 2025 36 Score: 0 Attempted: 0/36 Subscribe 1. : What is the primary purpose of memory management in data structures? (A) To store data permanently (B) To efficiently allocate and deallocate memory (C) To increase processing speed (D) To compress data 2. : Which of the following is a type of memory allocation? (A) Static allocation (B) Dynamic allocation (C) Both A and B (D) None of the above 3. : What is static memory allocation? (A) Memory is allocated at runtime (B) Memory is allocated at compile time (C) Memory is allocated using pointers (D) Memory is allocated in heap 4. : What is dynamic memory allocation? (A) Memory is allocated before the program starts (B) Memory is allocated during program execution (C) Memory is never freed (D) Memory is allocated using fixed sizes 5. : Which function is used to allocate memory dynamically in C? (A) malloc() (B) alloc() (C) new (D) reserve() 6. : What happens if memory allocated using malloc() is not freed? (A) Memory leak occurs (B) The program runs faster (C) No effect (D) The program terminates 7. : Which function is used to deallocate memory in C? (A) free() (B) delete (C) release() (D) dealloc() 8. : What is a memory leak? (A) Memory used by the program is freed (B) Memory allocated but not released (C) Memory allocated at compile time (D) Memory used for global variables 9. : Which of the following is a disadvantage of dynamic memory allocation? (A) Flexibility (B) Fragmentation (C) Easy to implement (D) Efficient memory usage 10. : What is fragmentation in memory management? (A) Allocation of memory in large blocks (B) Inefficient use of memory due to allocation and deallocation (C) Memory being accessed by multiple programs (D) None of the above 11. : What is the purpose of the ‘sizeof’ operator in C/C++? (A) To determine the size of a variable in bytes (B) To allocate memory dynamically (C) To free allocated memory (D) To copy data from one variable to another 12. : What is the difference between stack and heap memory? (A) Stack is used for static allocation, heap for dynamic (B) Stack is faster than heap (C) Stack memory is managed automatically, heap is manually managed (D) All of the above 13. : What type of memory allocation does the ‘new’ keyword perform in C++? (A) Static allocation (B) Dynamic allocation (C) Stack allocation (D) None of the above 14. : Which operator is used to deallocate memory allocated with ‘new’ in C++? (A) delete (B) free (C) dealloc (D) release 15. : What can cause a dangling pointer? (A) Allocating memory correctly (B) Freeing memory that is still in use (C) Using static memory (D) None of the above 16. : Which of the following methods can help prevent memory leaks? (A) Using static memory only (B) Properly freeing all allocated memory (C) Allocating large chunks of memory (D) Using global variables 17. : In which scenario would you prefer dynamic memory allocation? (A) When the size of data is known at compile time (B) When data size may vary during execution (C) When you want to optimize execution time (D) When you want to minimize memory usage 18. : What is the main advantage of using dynamic memory allocation? (A) Faster execution (B) Greater control over memory usage (C) No need for memory management (D) Simpler code 19. : Which of the following is NOT a memory management technique? (A) Paging (B) Segmentation (C) Compiling (D) Fragmentation 20. : What is a memory pool? (A) A single large block of memory (B) A collection of fixed-size memory blocks (C) A way to allocate stack memory (D) A method to sort memory addresses 21. : What is the purpose of garbage collection? (A) To improve program execution speed (B) To automatically free unused memory (C) To allocate more memory (D) To manage static memory 22. : What is the impact of not managing memory properly in a program? (A) Increased performance (B) Reduced memory consumption (C) Crashes and unpredictable behavior (D) Simplified code structure 23. : In what situation would stack memory be preferred over heap memory? (A) When the size of data is unknown (B) When data needs to be persistent (C) When speed is critical and size is fixed (D) When data needs to be shared 24. : Which of the following is a common method to detect memory leaks? (A) Code reviews (B) Memory profiling tools (C) Reducing the number of variables (D) Using static memory 25. : What does the term ‘stack overflow’ refer to? (A) Excessive allocation of heap memory (B) The stack exceeding its size limit (C) Memory being allocated incorrectly (D) None of the above 26. : What is a sentinel value in memory management? (A) A value that indicates the end of a data structure (B) A type of memory allocation (C) A pointer to a memory address (D) A method of freeing memory 27. : What is the primary function of the operating system in memory management? (A) To allocate memory to running programs (B) To compile programs (C) To monitor program execution (D) To free unused memory 28. : How does segmentation differ from paging? (A) Segmentation is based on variable-size blocks, while paging is fixed-size (B) Segmentation is faster than paging (C) Paging uses less memory than segmentation (D) There is no difference 29. : What is ‘thrashing’ in the context of memory management? (A) Excessive swapping of data between memory and disk (B) An efficient use of memory (C) An increase in memory speed (D) None of the above 30. : What is an object in memory management? (A) A pointer to a memory address (B) A block of memory that has a specific type (C) A variable (D) None of the above 31. : What is the main disadvantage of static memory allocation? (A) It is faster (B) It is less flexible (C) It requires more coding (D) It is not portable 32. : Which of the following best describes a heap? (A) A specific area of memory used for stack allocation (B) A memory area for dynamic allocation (C) A method of memory management (D) None of the above 33. : What are memory addresses? (A) Locations in the CPU (B) Locations in the RAM (C) The speed of memory (D) The data types of variables 34. : How can memory fragmentation be reduced? (A) By using dynamic allocation only (B) By using fixed-size memory blocks (C) By allocating all memory at once (D) By increasing memory size 35. : What does a pointer represent in memory management? (A) A variable (B) An address in memory (C) A type of allocation (D) A memory error 36. : What type of memory is automatically managed by the compiler? (A) Heap memory (B) Stack memory (C) Global memory (D) Static memory Data Structures MCQs Basic Concepts Introduction to Data Structures Abstract Data Types (ADT) MCQs Complexity Analysis MCQs Time complexity MCQs Space complexity MCQs Big O, Big Ω, Big Θ notations MCQs Linear Data Structures MCQs Arrays MCQs One-dimensional arrays MCQs Multi-dimensional arrays MCQs Operations: traversal, insertion, deletion MCQs Linked Lists MCQs Singly linked list MCQs Doubly linked list MCQs Circular linked list MCQs Stacks MCQs Stack operations (push, pop, peek) MCQs Applications of stacks (expression evaluation, recursion) MCQs Queues MCQs Queue operations (enqueue, dequeue, front, rear) MCQs Types: Simple queue, circular queue, priority queue, deque MCQs Non-Linear Data Structures MCQs Trees MCQs Binary trees MCQs Binary Search Trees (BST) MCQs AVL Trees MCQs B-trees and B+ trees MCQs Tree traversal methods (in-order, pre-order, post-order) MCQs Heaps MCQs Min-heap MCQs Max-heap MCQs Heap operations (insertion, deletion, heapify) MCQs Applications of heaps (priority queues, heap sort) MCQs Graphs MCQs Graph representation (adjacency matrix, adjacency list) MCQs Graph traversal algorithms (DFS, BFS) MCQs Shortest path algorithms (Dijkstra’s, Bellman-Ford) MCQs Minimum Spanning Tree (Kruskal’s, Prim’s) MCQs Hashing MCQs MCQs Hash Tables Hash functions MCQs Collision resolution techniques (chaining, open addressing) MCQs Applications of hashing MCQs Sorting and Searching Algorithms MCQs Sorting Algorithms MCQs Bubble sort MCQs Selection sort MCQs Insertion sort MCQs Merge sort MCQs Quick sort MCQs Heap sort MCQs Searching Algorithms MCQs Linear search MCQs Binary search MCQs Interpolation search MCQs Miscellaneous Memory Management in data structures MCQs Dynamic memory allocation MCQs Garbage collection MCQs String Manipulation Algorithms MCQs Pattern matching (KMP, Rabin-Karp) MCQs String hashing MCQs Data Structures MCQs 1 Data Structures MCQs 2 Data Structures MCQs 3 Data Structures MCQs 4 Data Structures MCQs 5 Stacks Solved MCQs Queues MCQs pointer mcqs Array MCQs Related Posts:Shared Memory vs Distributed Memory MCQsDifference Between Primary Memory and Secondary MemoryDifference between homologous structures and analogous structuresMemory management (stack, heap, static)(MCQs)Memory Management MCQsMemory Management MCQs Questions Answers