Memory Management in C (original) (raw)
Which of the following functions is used for dynamic memory allocation in C?
What header file is needed to use malloc() and free()?
Which function deallocates memory previously allocated using malloc()?
Which of the following allocates memory and also initializes it to zero?
What happens if you forget to free memory allocated with malloc()?
What is the key difference between malloc() and calloc()?
- calloc() doesn't require casting
- malloc() initializes memory to zero
- calloc() initializes memory to zero
What does realloc(ptr, 0) do?
- Resizes memory to 0 but keeps the pointer valid
What is returned by malloc() if the allocation fails?
What happens if you free() a pointer that was never dynamically allocated?
In the context of operating system memory design, what is the core structural difference between Paged Segmentation and Segmented Paging architectures?
(GATE CSE 1995 | MCQ | 1-mark)
- The segment table is paged; segments are also paged
- Segments are paged; the segment table is paged
- Removes internal vs external fragmentation
- Uses a single-page table; no MMU register
There are 20 questions to complete.
Take a part in the ongoing discussion