Question 1
Which of the following functions is used for dynamic memory allocation in C?
malloc()
alloc()
memalloc()
memory()
Question 2
What header file is needed to use malloc() and free()?
stdio.h
stdlib.h
malloc.h
mem.h
Question 3
Which function deallocates memory previously allocated using malloc()?
clear()
remove()
free()
delete()
Question 4
Which of the following allocates memory and also initializes it to zero?
malloc()
calloc()
realloc()
memset()
Question 5
What happens if you forget to free memory allocated with malloc()?
Compilation error
Segmentation fault
Memory leak
Pointer corruption
Question 6
What is the key difference between malloc() and calloc()?
malloc() is faster
calloc() doesn't require casting
malloc() initializes memory to zero
calloc() initializes memory to zero
Question 7
What does realloc(ptr, 0) do?
Resizes memory to 0 but keeps the pointer valid
Same as free(ptr)
Creates an error
No effect
Question 8
What is returned by malloc() if the allocation fails?
0
-1
NULL
Causes Error.
Question 9
What happens if you free() a pointer that was never dynamically allocated?
Nothing
Compiler warning
Undefined behavior
Graceful termination
Question 10
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.